<?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 to code proc mixed with repeated statements for blocking and repeated measures in time? in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-code-proc-mixed-with-repeated-statements-for-blocking-and/m-p/341975#M17982</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Maybe you can just use two proc mixed statements and have one repeated statement in each proc mixed statement?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Kriss&lt;/P&gt;</description>
    <pubDate>Fri, 17 Mar 2017 13:34:31 GMT</pubDate>
    <dc:creator>djrisks</dc:creator>
    <dc:date>2017-03-17T13:34:31Z</dc:date>
    <item>
      <title>How to code proc mixed with repeated statements for blocking and repeated measures in time?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-code-proc-mixed-with-repeated-statements-for-blocking-and/m-p/340444#M17918</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I am performing analyses on water quality data. I want to test whether there are difference in average TP concentrations between 5 sites, and whether these differences depend on the year of sampling.&lt;/P&gt;
&lt;P&gt;I have three years of data: 12 samples were taken between March and October in 2014, 11 samples were taken between March and October in 2015, and 9 samples were taken between March and October in 2016.&lt;/P&gt;
&lt;P&gt;For every sampling date measurements were taken at all 5 sites. I have attached some “fake” data so you can see how it is structured.&lt;/P&gt;
&lt;P&gt;I want to “pair” samples by date to account for variability caused by weather etc. on a given date. I also want to “correct for” temporal autocorrelation- samples taken close together in time are more similar than those taken further apart. I am assuming samples taken in a given year are independent from samples taken in other years. The intervals between measurements are not equal so I am theoretically unable to use variance-covariance structures such as AR(1), toep, arma(1,1), and ante(1).&lt;/P&gt;
&lt;P&gt;I have attempted the above in proc mixed with the code at the bottom of the post. To block by day I have included a repeated statement with Date(Year) as the subject. Analyses without accounting for temporal autocorrelation showed an unstructured variance-covariance structure to be the best fit. I am allowing different var-cov matrices for each year with the group=year option. To account for temporal (residual) autocorrelation I added another repeated statement, with Site as the subject, that models the structure of temporal autocorrelation using the sp(exp) option and the variable “Day_nmbr”, which is a continuous variable representing the day as a number between 1 and 365. Note that I also have “Date” as a class variable for purpose of blocking, above. Again, I used the group=year option to allow a different autocorrelation structure in each year. Note-I haven’t explored the best residual autocorrelation model yet, but sp(exp) is a likely fit.&lt;/P&gt;
&lt;P&gt;When I run this code with either one of the repeated statements it works, but when I run it with both statements SAS only uses the second statement (I get this message: WARNING: Only the last REPEATED statement is used). I am presuming (or perhaps hoping!) that I have just coded something incorrectly. Perhaps there is a way to combine the repeated statements? Can anyone help me think of a way to code that will allow me to do what I have described?&lt;/P&gt;
&lt;P&gt;Thanks for any help!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Proc&lt;/STRONG&gt; &lt;STRONG&gt;mixed&lt;/STRONG&gt; data=sites;&lt;/P&gt;
&lt;P&gt;class Date Year Site;&lt;/P&gt;
&lt;P&gt;model TP = Site Year Site*Year / solution ddfm=kenwardroger outp= pred_data;&lt;/P&gt;
&lt;P&gt;Repeated / subject= Date(Year) type=un group=year r rcorr;&lt;/P&gt;
&lt;P&gt;Repeated / subject= Site type=sp(exp)(Day_nmbr)group=year r rcorr;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using SAS 9.3&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2017 15:01:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-code-proc-mixed-with-repeated-statements-for-blocking-and/m-p/340444#M17918</guid>
      <dc:creator>Kojema</dc:creator>
      <dc:date>2017-03-13T15:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to code proc mixed with repeated statements for blocking and repeated measures in time?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-code-proc-mixed-with-repeated-statements-for-blocking-and/m-p/341975#M17982</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Maybe you can just use two proc mixed statements and have one repeated statement in each proc mixed statement?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Kriss&lt;/P&gt;</description>
      <pubDate>Fri, 17 Mar 2017 13:34:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-code-proc-mixed-with-repeated-statements-for-blocking-and/m-p/341975#M17982</guid>
      <dc:creator>djrisks</dc:creator>
      <dc:date>2017-03-17T13:34:31Z</dc:date>
    </item>
  </channel>
</rss>

