title: Analyze Repeated Measures Data Using PROC GLIMMIX
body: <p>I am using PROC GLIMMIX to analyze repeated measures data about specific sexual events. The original data came from a weekly diary study of about 400 people. During each week they reported on behaviours from their most recent sexual encounter. We also have basline data on their demographics. 12 weeks of observation were collected and we had a high completion rate. </p>
  
  <p>I would like to create a mixed effect model, but I am unsure exactly how this is done in SAS. I want to test the effect of event-specific factors as well as some person level demographics and would like to get odds ratios for each factor of interest. The outcome is whether or not drugs were used during the event and the explanatory factors will be things like age, gender, etc. as well as characteristics about the event (i.e., partner HIV status), whether the partner was a regular sexual partner, etc..</p>
  
  <p>The code I'm working with follows this pattern:</p>
  
  <p><code>PROC GLIMMIX DATA=work.dataset oddsratio;
  CLASS VISIT_NUMBER PARTICIPANT_ID BINARY_EVENTLEVEL_OUTCOME BINARY_EVENTLEVEL_EXPLANATORY_FACTOR CATEGORICAL_PERSONLEVEL_EXPLANATORY_FACTOR;
  MODEL BINARY_EVENTLEVEL_OUTCOME = BINARY_EVENTLEVEL_EXPLANATORY CATEGORICAL_PERSONLEVEL_EXPLANATORY_FACTOR /DIST=binary link=logit CL S ddfm=kr;
  RANDOM ?????;
  RUN;
  </code></p>
  
  <ul>
  <li>option 1 for ?????: <em>residual</em> / subject=PARTICIPANT_ID </li>
  <li>option 2 for ?????: INTERCEPT / subject=PARTICIPANT_ID </li>
  <li>option 3 for ?????: VISIT_NUM / subject=PARTICIPANT_ID residual type=ar(1)
                     INTERCEPT / subject=VISIT_NUM(PARTICIPANT_ID)</li>
  <li>option 4 for ?????: Other?</li>
  </ul>
  
  <p>I am also unclear whether I should use ddfm=kr in my model statement or method=laplace in my proc statement -- both have been recommended elsewhere for this sort of repeated measures analysis.</p>
  
  <p>I've come across several potential options for modelling this which often give similar results, but option 1 gives a statistically significant result for an event-level, while the others give non-significant results. The inclusion of the ddfm=kr makes the result of interest more significant. The method=laplace does not allow for option 1.</p>