turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- How can I test a nonlinear hypothesis in MIXED or ...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-11-2016 07:26 AM

I have data on approximately 50 people who were treated for drug abuse with a novel treatment. At baseline and at 5 equally spaced follow ups, they were evaluated for various problems on continuous scales. I want to test the hypothesis that there was an improvement from baseline to 3 months and then no retreat from that improvement.

I know I can do equivalence testing on pairs of follow up points, but I am thinking of some sort of spline effect in MIXED or GLIMMIX. But I haven't quite figured out how to code it.

Any hints appreciated.

Using SAS 9.4.

Accepted Solutions

Solution

02-17-2016
06:29 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to plf515

02-12-2016 10:27 AM - edited 02-12-2016 10:32 AM

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:

All Replies

Solution

02-17-2016
06:29 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to plf515

02-12-2016 10:27 AM - edited 02-12-2016 10:32 AM

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:

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to JacobSimonsen

02-12-2016 10:48 AM

Thanks! That looks like a good approach

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to plf515

02-15-2016 03:03 PM - edited 02-15-2016 03:05 PM

I really like Jacob's approach.

Here is something a little simpler, along the lines of a Helmert contrast. You do have to expand this out, as I have only put in the time coefficients, so this would be for the first treatment arm:

```
LSMESTIMATE time*treatment 'pre vs all follow' -5 1 1 1 1 1 divisor 5,
'time 1 vs follow' 0 -4 1 1 1 1 divisor 4,
'time 2 vs follow' 0 0 -3 1 1 1 divisor 3,
'time 3 vs follow' 0 0 0 -2 1 1 divisor 2,
'time 4 vs follow' 0 0 0 0 -1 1/joint;
```

Additional arms, and comparisons between them follow from this.

Steve Denham