BookmarkSubscribeRSS Feed
sleblanc
Calcite | Level 5
I am looking for help on how to account for cluster randomization in a Cox model, specifically, how to specify the experimental unit so as to get correct degrees of freedom on treatment.
 
Using SAS 9.4.
 
We have conducted a cluster randomized trial in dairy cows.  That means outcomes were measured at the level of the cow, but dietary treatment was assigned to pens (groups of cows in the same pen at the same time on a farm).  Here, 2 treatments, 4 farms, 4 study periods on each farm (2 TRT, 2 control, alternated within a farm over time e.g. 3 months on TRT, 3 months on CON, 3 mo on TRT, 3 mo on CON; random which one to start). To specify the correct experimental unit and get appropriate denominator d.f. in linear and logistic models, we use a RANDOM treatment*farm*period term in MIXED and GLIMMIX.
 
The question is, in PHREG how can we specify to get an appropriate ddf for treatment?
 
I have played with creating the treatment*farm*period term in a data step and specifying that as a RANDOM term in PHREG:
 
data clustered; set full.data;
cluster = treatment*farm*period;
 
Proc PHREG data=clustered ;
class treatment farm period ;
model timetopregnancy*pregnant(0) = treatment / ties = exact risklimits ;
random cluster ;
run;
 
I get a somewhat smaller "adjusted df" for treatment in the "Type 3 Effects" table than without this random term, and a wider CI on the HR for treatment.  Seems right...? Is this valid?
1 REPLY 1
SteveDenham
Jade | Level 19

I haven't done this so take it with a grain (or maybe a block) of salt.  PHREG doesn't allow for setting arbitrary values of DDF, which I was hoping to find.  Given that rather discouraging discovery, I believe that the approach you have taken here best fits the algorithms used in PHREG (in particular it seems to fit Example 85.11 in the SAS/STAT 14.1 documentation).  I believe that you are estimating an additional variance component due to the cluster, so having a wider CL is not unexpected. I would consider adding an ASSESS statement to check on whether the PH assumption is met under clustering.

 

SteveDenham

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 754 views
  • 0 likes
  • 2 in conversation