I have been asked to asked to analyse a stepped-wedge cluster randomised trial that I did not design. Because the trial protocol has already been registered, I don't have much flexibility in the way the analysis needs to be performed.
The trial involved an intervention to increase the detection of a particular medical condition in primary care. (The condition was thought to be under diagnosed.) About 1,500 people (patients) from 12 health services (clusters) were followed for several years. Hence, this is longitudinal data, not repeated cross-sectional samples.
Here is some example data for person number 1, who belongs to cluster number 10:
--------------------------------------------------------
| person_id | cluster | time | intervention | detected |
--------------------------------------------------------
| 1 | 10 | 1 | 0 | 0 |
| 1 | 10 | 2 | 0 | 0 |
| 1 | 10 | 3 | 0 | 0 |
| 1 | 10 | 4 | 1 | 0 |
| 1 | 10 | 5 | 1 | 0 |
| 1 | 10 | 6 | 1 | 0 |
| 1 | 10 | 7 | 1 | 1 |
| 1 | 10 | 8 | 1 | 1 |
--------------------------------------------------------
At timepoint 4, the cluster that this person belongs to entered the intervention. At timepoint 7, the medical condition was detected in this person.
A few people already have the medical condition diagnosed at baseline, in which case the detected variable will be set to 1 at all time periods.
The trial protocol says that the analysis will be performed with a generalised linear mixed model. Variation between clusters will be modelled as a random intercept effect, and nested within these, time will be treated as a random coefficient effect.
Can this be done with something as simple as:
Stata:
melogit detected i.intervention i.time || cluster: i.time || person_id:, or
R:
m <- glmer(detected ~ intervention + time + (1 + time | cluster) + (1 | person_id),
data = myData, family = binomial, control =
glmerControl(optimizer = "bobyqa"), nAGQ = 10)
I have been trying this syntax but my models do not converge.
I haven't worked with these models before, and any advice (preferably with Stata syntax) would be greatly appreciated.