The PLM Procedure

Example 88.6 Comparing Multiple B-Splines

(View the complete code for this example.)

This example conducts an analysis similar to Example 15 in Examples: GLIMMIX Procedure: Examples: GLIMMIX Procedure. It uses simulated data to perform multiple comparisons among predicted values in a model with group-specific trends that are modeled through regression splines. The estimable functions are formed using nonpositional syntax with constructed effects. Consider the data in the following DATA step. Each of the 100 observations for the continuous response variable y is associated with one of two groups.

data spline;
   input group y @@;
   x = _n_;
   datalines;
 1    -.020 1    0.199 2    -1.36 1    -.026
 2    -.397 1    0.065 2    -.861 1    0.251
 1    0.253 2    -.460 2    0.195 2    -.108
 1    0.379 1    0.971 1    0.712 2    0.811
 2    0.574 2    0.755 1    0.316 2    0.961
 2    1.088 2    0.607 2    0.959 1    0.653
 1    0.629 2    1.237 2    0.734 2    0.299
 2    1.002 2    1.201 1    1.520 1    1.105
 1    1.329 1    1.580 2    1.098 1    1.613
 2    1.052 2    1.108 2    1.257 2    2.005
 2    1.726 2    1.179 2    1.338 1    1.707
 2    2.105 2    1.828 2    1.368 1    2.252
 1    1.984 2    1.867 1    2.771 1    2.052
 2    1.522 2    2.200 1    2.562 1    2.517
 1    2.769 1    2.534 2    1.969 1    2.460
 1    2.873 1    2.678 1    3.135 2    1.705
 1    2.893 1    3.023 1    3.050 2    2.273
 2    2.549 1    2.836 2    2.375 2    1.841
 1    3.727 1    3.806 1    3.269 1    3.533
 1    2.948 2    1.954 2    2.326 2    2.017
 1    3.744 2    2.431 2    2.040 1    3.995
 2    1.996 2    2.028 2    2.321 2    2.479
 2    2.337 1    4.516 2    2.326 2    2.144
 2    2.474 2    2.221 1    4.867 2    2.453
 1    5.253 2    3.024 2    2.403 1    5.498
;

The following statements fit a model with separate trends for the two groups; the trends are modeled as B-splines.

proc orthoreg data=spline;
   class group;
   effect spl = spline(x);
   model y = group spl*group / noint;
   store ortho_spline;
   title 'B-splines Comparisons';
run;

Results from this analysis are shown in Output 88.6.1. The "Parameter Estimates" table shows the estimates for the spline coefficients in the two groups.

Output 88.6.1: Results for Group-Specific Spline Model

B-splines Comparisons

The ORTHOREG Procedure
 
Dependent Variable: y

SourceDFSum of SquaresMean SquareF ValuePr > F
Model13153.017556111.770581238160.11<.0001
Error866.32238041190.0735160513  
Corrected Total99159.33993651   

Root MSE0.2711384357
R-Square0.9603214326

ParameterDFParameter EstimateStandard
Error
t ValuePr > |t|
(group='1')19.702654639620393.13418999873.100.0026
(group='2')16.306192205635692.62991477682.400.0187
spl*group 1 11-11.17864517180413.7008097395-3.020.0033
spl*group 1 21-20.19460927461393.9765046236-5.08<.0001
spl*group 2 11-9.532736979953013.2575832048-2.930.0044
spl*group 2 21-5.856524965349672.7906116773-2.100.0388
spl*group 3 11-8.961183718932943.0717508806-2.920.0045
spl*group 3 21-5.556716052452052.5716715573-2.160.0335
spl*group 4 11-7.261532314787553.243690314-2.240.0278
spl*group 4 21-4.367788897382362.7246809593-1.600.1126
spl*group 5 11-6.446152565108962.9616955361-2.180.0323
spl*group 5 21-4.038016189149022.4588839125-1.640.1042
spl*group 6 11-4.638169590941393.7094636319-1.250.2146
spl*group 6 21-4.302901043950613.0478540171-1.410.1616
spl*group 7 100...
spl*group 7 200...


By default, the ORTHOREG procedure constructs B-splines with seven knots. Since B-spline coefficients satisfy a sum-to-one constraint and since the model contains group-specific intercepts, the last spline coefficient for each group is redundant and is set to 0.

The following statements make a prediction for the input data set by using the SCORE statement with PROC PLM and graph the observed and predicted values in the two groups:

proc plm restore=ortho_spline;
   score data=spline out=ortho_pred predicted=p;
run;

proc sgplot data=ortho_pred;
   series  y=p x=x / group=group name="fit";
   scatter y=y x=x / group=group;
   keylegend "fit" / title="Group";
run;

The prediction plot in Output 88.6.2 suggests that there is some separation of the group trends for small values of x and for values that exceed about x = 40.

Output 88.6.2: Observed Data and Predicted Values by Group

 Observed Data and Predicted Values by Group


In order to determine the range on which the trends separate significantly, the PLM procedure is executed in the following statements with an ESTIMATE statement that applies group comparisons at a number of values for the spline variable x:

%macro GroupDiff;
   %do x=0 %to 75 %by 5;
      "Diff at x=&x" group 1 -1 group*spl [1,1  &x] [-1,2  &x],
   %end;
   'Diff at x=80' group 1 -1 group*spl [1,1 80] [-1,2 80]
%mend;

proc plm restore=ortho_spline;
   show effects;
   estimate %GroupDiff / adjust=simulate seed=1 stepdown;
run;

For example, the following ESTIMATE statement compares the trends between the two groups at x = 25:

estimate 'Diff at x=25' group 1 -1 group*spl [1,1 25] [-1,2 25];

The nonpositional syntax is used for the group*spl effect. For example, the specification requests that the spline be computed at x = 25 for the second level of variable group. The resulting coefficients are added to the vector for the estimate after being multiplied with –1.

Because comparisons are made at a large number of values for x, a multiplicity correction is in order to adjust the p-values to reflect familywise error control. Simulated p-values with step-down adjustment are used here.

Output 88.6.3 displays the "Store Information" for the item store and information about the spline effect (the result of the SHOW statement).

Output 88.6.3: Spline Details

B-splines Comparisons

The PLM Procedure

Store Information
Item StoreWORK.ORTHO_SPLINE
Data Set Created FromWORK.SPLINE
Created ByPROC ORTHOREG
Date Created06APR15:20:21:11
Response Variabley
Class Variablegroup
Constructed Effectspl
Model Effectsgroup spl*group

B-splines Comparisons

The PLM Procedure

Knots for Spline Effect spl
Knot NumberBoundaryx
1*-48.50000
2*-23.75000
3*1.00000
4 25.75000
5 50.50000
6 75.25000
7*100.00000
8*124.75000
9*149.50000

B-splines Comparisons

The PLM Procedure

Basis Details for Spline Effect spl
ColumnSupportSupport Knots
1-48.5000025.750001-4
2-48.5000050.500001-5
3-23.7500075.250002-6
41.00000100.000003-7
525.75000124.750004-8
650.50000149.500005-9
775.25000149.500006-9


Output 88.6.4 displays the results from the ESTIMATE statement.

Output 88.6.4: Estimate Results with Multiplicity Correction

Estimates
Adjustment for Multiplicity: Holm-Simulated
LabelEstimateStandard ErrorDFt ValuePr > |t|Adj P
Diff at x=012.41244.2130862.950.00410.0206
Diff at x=51.03760.1759865.90<.0001<.0001
Diff at x=100.37780.1540862.450.01620.0545
Diff at x=150.058220.1481860.390.69520.9101
Diff at x=20-0.026020.124386-0.210.83460.9565
Diff at x=250.020140.1312860.150.87830.9565
Diff at x=300.10230.1378860.740.46000.7418
Diff at x=350.19240.1236861.560.12310.2925
Diff at x=400.28830.1114862.590.01130.0450
Diff at x=450.38770.1195863.240.00170.0096
Diff at x=500.48850.1308863.740.00030.0024
Diff at x=550.59030.1231864.79<.0001<.0001
Diff at x=600.70310.1125866.25<.0001<.0001
Diff at x=650.84010.1203866.99<.0001<.0001
Diff at x=701.01470.1348867.52<.0001<.0001
Diff at x=751.24000.1326869.35<.0001<.0001
Diff at x=801.52370.12818611.89<.0001<.0001


Notice that the "Store Information" in Output 88.6.3 displays the classification variables (from the CLASS statement in PROC ORTHOREG), the constructed effects (from the EFFECT statement in PROC ORTHOREG), and the model effects (from the MODEL statement in PROC ORTHOREG). Output 88.6.4 shows that at the 5% significance level the trends are significantly different for and for . Between those values you cannot reject the hypothesis of trend congruity.

To see this effect more clearly, you can filter the results by adding the a filtering statement to the previous PROC PLM step:

proc plm restore=ortho_spline;
   estimate %GroupDiff / adjust=simulate seed=1 stepdown;
   filter adjp > 0.05;
run;

This produces Output 88.6.5, which displays the subset of the results in Output 88.6.4 that meets the condition in the FILTER expression.

Output 88.6.5: Filtered Estimate Results

B-splines Comparisons

The PLM Procedure

Estimates
Adjustment for Multiplicity: Holm-Simulated
LabelEstimateStandard ErrorDFt ValuePr > |t|Adj P
Diff at x=100.37780.1540862.450.01620.0545
Diff at x=150.058220.1481860.390.69520.9101
Diff at x=20-0.026020.124386-0.210.83460.9565
Diff at x=250.020140.1312860.150.87830.9565
Diff at x=300.10230.1378860.740.46000.7418
Diff at x=350.19240.1236861.560.12310.2925