<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How can I test a nonlinear hypothesis in MIXED or GLIMMIX? in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/How-can-I-test-a-nonlinear-hypothesis-in-MIXED-or-GLIMMIX/m-p/249704#M13128</link>
    <description>&lt;P&gt;What a funny question. I think I have a kind of solution, but its not perfect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;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&amp;gt;3.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
  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;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and here is the figure:&lt;IMG title="predict.JPG" alt="predict.JPG" src="https://communities.sas.com/t5/image/serverpage/image-id/1869iFB530258BCBC1EEB/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Feb 2016 15:32:37 GMT</pubDate>
    <dc:creator>JacobSimonsen</dc:creator>
    <dc:date>2016-02-12T15:32:37Z</dc:date>
    <item>
      <title>How can I test a nonlinear hypothesis in MIXED or GLIMMIX?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-can-I-test-a-nonlinear-hypothesis-in-MIXED-or-GLIMMIX/m-p/249430#M13111</link>
      <description>&lt;P&gt;I have data on approximately 50 people who were treated for drug abuse with a novel treatment.&amp;nbsp; At baseline and at 5 equally spaced follow ups, they were evaluated for various problems on continuous scales.&amp;nbsp; I want to test the hypothesis that there was an improvement from baseline to 3 months and then no retreat from that improvement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any hints appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using SAS 9.4.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2016 12:26:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-can-I-test-a-nonlinear-hypothesis-in-MIXED-or-GLIMMIX/m-p/249430#M13111</guid>
      <dc:creator>plf515</dc:creator>
      <dc:date>2016-02-11T12:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: How can I test a nonlinear hypothesis in MIXED or GLIMMIX?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-can-I-test-a-nonlinear-hypothesis-in-MIXED-or-GLIMMIX/m-p/249704#M13128</link>
      <description>&lt;P&gt;What a funny question. I think I have a kind of solution, but its not perfect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;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&amp;gt;3.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
  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;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and here is the figure:&lt;IMG title="predict.JPG" alt="predict.JPG" src="https://communities.sas.com/t5/image/serverpage/image-id/1869iFB530258BCBC1EEB/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2016 15:32:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-can-I-test-a-nonlinear-hypothesis-in-MIXED-or-GLIMMIX/m-p/249704#M13128</guid>
      <dc:creator>JacobSimonsen</dc:creator>
      <dc:date>2016-02-12T15:32:37Z</dc:date>
    </item>
    <item>
      <title>Re: How can I test a nonlinear hypothesis in MIXED or GLIMMIX?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-can-I-test-a-nonlinear-hypothesis-in-MIXED-or-GLIMMIX/m-p/249710#M13131</link>
      <description>&lt;P&gt;Thanks!&amp;nbsp; That looks like a good approach&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2016 15:48:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-can-I-test-a-nonlinear-hypothesis-in-MIXED-or-GLIMMIX/m-p/249710#M13131</guid>
      <dc:creator>plf515</dc:creator>
      <dc:date>2016-02-12T15:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: How can I test a nonlinear hypothesis in MIXED or GLIMMIX?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-can-I-test-a-nonlinear-hypothesis-in-MIXED-or-GLIMMIX/m-p/250168#M13180</link>
      <description>&lt;P&gt;I really like Jacob's approach.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is something a little simpler, along the lines of a Helmert contrast. &amp;nbsp;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:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Additional arms, and comparisons between them follow from this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Steve Denham&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2016 20:05:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-can-I-test-a-nonlinear-hypothesis-in-MIXED-or-GLIMMIX/m-p/250168#M13180</guid>
      <dc:creator>SteveDenham</dc:creator>
      <dc:date>2016-02-15T20:05:42Z</dc:date>
    </item>
  </channel>
</rss>

