What a funny question. I think I have a kind of solution, but its not perfect.
I suggest to make a model with a natural cubic spline. In the second model I suggest making a variable that is minimum of time and 3, and then make a natural cubic spline on that one. Then test from the first model to the second model. It is not perfect, because the second model has a non-differentiabable point at time=3. So it is neccessary to allow the same in the first model if the second model should be contained in the first model.
Secondly, it is very difficult to test that the change in the interval from 0 to 3 should be positive (improvement). The method here only test that there is a spline up to time=3, and constant for time>3.
Here is the code:
data mydata;
do i=1 to 500;
time=6*ranuni(-1);
time2=min(time,3);
effekt=mod(i,2);
y=2+time+rannor(-1);
output;
end;
run;
*The test is seen it the type3 tests;
proc glimmix data=mydata;
effect spline1 = spline(time / NATURALCUBIC knotmethod=list(0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5) );
effect spline2 = spline(time2 / NATURALCUBIC knotmethod=list(0.5,1,1.5,2,2.5) );
model y=effekt effekt*spline1 effekt*spline2 /dist=normal ;
store out=model1;
run;
proc glimmix data=mydata;
effect spline2 = spline(time2 / NATURALCUBIC knotmethod=list(0.5,1,1.5,2,2.5) );
model y=effekt effekt*spline2 /dist=normal ;
store out=model2;
run;
data template;
do effekt=0 to 1;
do time=0 to 6 by 0.01;
time2=min(time,3);
output;
end;
end;
ruN;
proc plm restore=model1;
score data=template out=pred1;
run;
proc plm restore=model2;
score data=template out=pred2;
run;
data pred;
merge pred1(rename=(predicted=pred1)) pred2(rename=(predicted=pred2));
by effekt time;
run;
symbol1 c=black i=none v=dot;
symbol2 c=red i=none v=dot;
proc gplot data=pred(where=(effekt));
plot (pred1 pred2 )*time/overlay;
run;
and here is the figure:
... View more