<?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 PROC MIXED, JOINT statement - difference in differences? in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-MIXED-JOINT-statement-difference-in-differences/m-p/875497#M43285</link>
    <description>&lt;P&gt;I am running a repeated measures mixed model, and I am testing the difference in differences.&lt;/P&gt;
&lt;P&gt;I want to see if the difference in the machines (1 or 2) is different between 2 treatments. Each patient is tested on 2 machines, at certain times. So for example - at time 1, is the difference in machine1 vs machine 2 different between group 1 and group 2.&lt;/P&gt;
&lt;P&gt;When using the 'joint' option in an LSMESTIMATE statement, is it possible to get an estimate of the difference in differences and CI of the difference?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know that the LMESTIMATE statement is correct as I am getting the correct values - I'm just not sure how to output the difference and CI of difference.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;PROC MIXED DATA=allt;&lt;BR /&gt;CLASS ptno machine time(ref="1") trt;&lt;BR /&gt;MODEL outcome = machine time trt machine*time trt*machine trt*time trt*machine*time ; &lt;BR /&gt;REPEATED time / subject=ptno(machine) type=un; &lt;BR /&gt;LSMeans machine*time*trt/ cl ;&lt;BR /&gt;LSMESTIMATE&amp;nbsp; &amp;nbsp; trt*machine*time 'T1,C-P, G1 vs G2'&lt;/P&gt;
&lt;P&gt;0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 -1 0 0,&amp;nbsp; &amp;nbsp; &amp;nbsp;0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 -1 0&amp;nbsp; / cl joint;&lt;/P&gt;</description>
    <pubDate>Fri, 12 May 2023 16:50:42 GMT</pubDate>
    <dc:creator>tka726</dc:creator>
    <dc:date>2023-05-12T16:50:42Z</dc:date>
    <item>
      <title>PROC MIXED, JOINT statement - difference in differences?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-MIXED-JOINT-statement-difference-in-differences/m-p/875497#M43285</link>
      <description>&lt;P&gt;I am running a repeated measures mixed model, and I am testing the difference in differences.&lt;/P&gt;
&lt;P&gt;I want to see if the difference in the machines (1 or 2) is different between 2 treatments. Each patient is tested on 2 machines, at certain times. So for example - at time 1, is the difference in machine1 vs machine 2 different between group 1 and group 2.&lt;/P&gt;
&lt;P&gt;When using the 'joint' option in an LSMESTIMATE statement, is it possible to get an estimate of the difference in differences and CI of the difference?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know that the LMESTIMATE statement is correct as I am getting the correct values - I'm just not sure how to output the difference and CI of difference.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;PROC MIXED DATA=allt;&lt;BR /&gt;CLASS ptno machine time(ref="1") trt;&lt;BR /&gt;MODEL outcome = machine time trt machine*time trt*machine trt*time trt*machine*time ; &lt;BR /&gt;REPEATED time / subject=ptno(machine) type=un; &lt;BR /&gt;LSMeans machine*time*trt/ cl ;&lt;BR /&gt;LSMESTIMATE&amp;nbsp; &amp;nbsp; trt*machine*time 'T1,C-P, G1 vs G2'&lt;/P&gt;
&lt;P&gt;0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 -1 0 0,&amp;nbsp; &amp;nbsp; &amp;nbsp;0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 -1 0&amp;nbsp; / cl joint;&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 16:50:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-MIXED-JOINT-statement-difference-in-differences/m-p/875497#M43285</guid>
      <dc:creator>tka726</dc:creator>
      <dc:date>2023-05-12T16:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: PROC MIXED, JOINT statement - difference in differences?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-MIXED-JOINT-statement-difference-in-differences/m-p/875522#M43286</link>
      <description>&lt;P&gt;See &lt;A href="https://support.sas.com/kb/61/830.html" target="_self"&gt;this note&lt;/A&gt; on the difference in difference (DID), particularly the first section and the last section titled "Estimating the difference in difference in models with covariates". As noted the last section, the estimate from the LSMESTIMATE statement (for this model using the identity link) as shown in the first section is an estimate of the DID averaged over the levels of the additional categorical predictor. This is shown in the example below. Note that the first LSMESTIMATE statement (and the ESTIMATE statement) give the estimate of the DID averaged over the C levels. But this might not be advisable if the C*A*B interaction is significant since this means that the DID for A and B changes over the levels of C. The next three LSMESTIMATE statements estimate the separate A*B DIDs in the levels of C and then average them to also get the averaged DID over C. The next LSMESTIMATE statement estimates the difference in the two DIDs between the C levels which is the C*A*B interaction. Finally, the last statement re-estimates the separate DIDs in the C levels and produces a joint test of the hypothesis that they both are zero. Though GENMOD is used for a model not involving repeated measures, the same would apply to your case.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;      data a;
        sd=3; 
        do c=1,0; 
        do a=1,0; 
        do b=1,0; 
          input mean @@; 
          do rep=1 to 10;
            y=rannor(23425)*sd+mean;
            output;
          end; 
        end; end;end;
        datalines;
      50 70 40 40
      60 90 20 40
      ;
      proc genmod plots=none;
        class a b c / ref=first;
        model y = a|b|c;
        estimate "Averaged DID" a*b 1 -1 -1 1;
        lsmeans a*b*c;
        lsmestimate a*b "Averaged DID" 1 -1 -1 1;
        lsmestimate a*b*c "DID c=1" 1 0 -1 0 -1 0 1;
        lsmestimate a*b*c "DID c=0" 0 1 0 -1 0 -1 0 1;
        lsmestimate a*b*c "Averaged DID" 1 1 -1 -1 -1 -1 1 1 / divisor=2;
        lsmestimate a*b*c "c*a*b = c Diff of a*b DIDs" 1 -1 -1 1 -1 1 1 -1 ;
        lsmestimate a*b*c "DID c=1" 1 0 -1 0 -1 0 1, "DID c=0" 0 1 0 -1 0 -1 0 1 / joint(label="Test both c DIDs = 0");
        run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 May 2023 20:44:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-MIXED-JOINT-statement-difference-in-differences/m-p/875522#M43286</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2023-05-12T20:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: PROC MIXED, JOINT statement - difference in differences?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-MIXED-JOINT-statement-difference-in-differences/m-p/876038#M43307</link>
      <description>&lt;P&gt;Perfect, thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2023 15:45:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-MIXED-JOINT-statement-difference-in-differences/m-p/876038#M43307</guid>
      <dc:creator>tka726</dc:creator>
      <dc:date>2023-05-16T15:45:04Z</dc:date>
    </item>
  </channel>
</rss>

