Analysis of Repeated Measures Data using SAS (1)
SAS code 1:
proc mixed data=yy method=reml;
where param="xxx";
class USUBJID treatment AVISITN timepoint;
model CHG =
BASE
treatment
AVISITN
timepoint
treatment*AVISITN
treatment*timepoint
AVISITN*timepoint
treatment*AVISITN*timepoint
/ solution ddfm=kr;
repeated Timepoint / subject=USUBJID*AVISITN type=un;
lsmeans treatment*AVISITN*timepoint / cl;
run;
SAS code 2:
proc mixed data=yy method=reml;
where param="xxx";
class USUBJID treatment AVISITN timepoint;
model CHG =
BASE
treatment
AVISITN
timepoint
treatment*AVISITN
treatment*timepoint
AVISITN*timepoint
treatment*AVISITN*timepoint
/ solution ddfm=kr;
repeated avisitn*Timepoint / subject=USUBJID type=un;
lsmeans treatment*AVISITN*timepoint / cl ;
run;
Difference in repeated
Statement:
- Subject = USUBJID*AVISITN: This treats each subject at each visit (
AVISITN
) as a separate experimental unit. In other words, it assumes that repeated measures are nested within each subject-visit combination. - Repeated = Timepoint: The repeated measures are taken across different timepoints within each subject-visit.
- Implication: This structure models the correlation of timepoints within each visit for each subject. It’s useful when you expect the correlation structure to reset or differ across visits.
- Subject = USUBJID: This treats each subject as the experimental unit, regardless of visit.
- Repeated = avisitn*Timepoint: The repeated measures are now defined across both visit and timepoint combinations.
- Implication: This structure models the correlation of all visit-timepoint combinations within each subject. It assumes a single covariance structure across all combinations of visit and timepoint.
Conceptual Summary
Feature | Code 1 | Code 2 |
---|---|---|
Subject | USUBJID*AVISITN | USUBJID |
Repeated Measures | Timepoint within each visit | Visit-Timepoint combinations |
Covariance Structure | Separate per visit | Unified across visits |
Use Case | When visits are independent or have different dynamics | When modeling all timepoints and visits jointly |
✅ Which to Use?
- Use Code 1 if you believe the correlation structure differs across visits (e.g., different treatment phases or conditions).
- Use Code 2 if you want to model a single covariance structure across all visit-timepoint combinations within each subject.
Comments
Post a Comment