Power Calculations in Longitudinal Mixed Effects - from two measurements to three measurements

Hi everyone. In recent weeks, I’ve been going down the rabbit hole about power calculations for longitudinal mixed effects.

One: in PAS software, it states that both in the GEE and mixed effects options, the power remains the same as we move from two measurements to three measurements

Second: The same results are yielded by the software WebPower - Statistical Power Analysis and Sample Size Planning for Linear mixed-effects model

Three: it appears that many of these calculations are based on the book Sample Size Calculations for Clustered and Longitudinal Outcomes in Clinical Research. Sponsored by LLMs, I was able to reproduce their table 5.3

.

Then I extended the codes to two, three, and four measurements. In that simulation, actually, the power increased a little bit, but almost no impact.

So questions are:

  1.  Are this references and code correct? I find it extremely counterintuitive and surprising that adding a third measurement has no/almost no impact on power.
    

I was expecting a 10 to 20% decrease on the sample size depending on the circumstances

  1.  On that note, does anyone have a verified R script that correctly calculates power for longitudinal designs in these scenarios?
    

I have attached some reports. Thank you

Rplot02.pdf (34.6 KB)

power_simulation_results_wide.pdf (236.3 KB)

Report6 gee.pdf (313.7 KB)

Side note: random effects are not the most natural way to model longitudinal data, and when you use random intercepts, adding more than around 7 repeats within subject adds no statistical information. That’s partially because random intercepts means compound symmetric correlation structure which means that time is not treated as directional. I learned this from here. The bottom line is that random effects are not likely to fit the true correlation structure.

1 Like

@Frank,

An FYI, while the older lme() function in the nlme package by Doug et al supported AR1 correlation structures with a continuous response, that had been lacking until just last month in lme4, which was a long standing and frustrating issue. The default in lme4, I believe, has been an unstructured correlation matrix.

Now with version 2.x for lme4, just released early last month, Ben et al have added new features to make it easier to specify alternative correlation structures, which brings those features inline with glmmTMB, which has been an alternative for many of those applications that required these, and other features.

The combinations of these ME model options and the emmeans package by Russ Lenth, have offered a great deal of flexibility in modeling longitudinal data and generating relevant contrasts.

More info from Ben here on the recent lme4 updates:

Regards,

Marc

1 Like

That’s excellent Marc - a nice addition to lme4. Adding random effects to AR(1) will help meet correlation structure assumptions, and having AR(1) in the model will make the random effects smaller which adds stability. In a similar vein I’ve seen one example where there was lack of fit of a Markov-1 ordinal model until random intercepts were added.

When there are random effects, it is more natural to use Bayesian models, which handle them better than trying to approximate marginal sampling distributions.

2 Likes

Thank you, Frank, once again. Please allow me to offer some pushback and ask a few further questions.

First, please note that I am not referring to scenarios with over seven measurements, but rather specifically the transition from two to three.

Additionally, this does not apply exclusively to random effects but also to GEE.

The previous software also indicates that when moving from compound symmetry to AR(1), the power actually decreases.

Regarding questions involving two, three, or four follow-up measurements: if I understood correctly, your preference would be for GLS or Markov models?

In those models, do you have to manually specify the correlation matrix during analysis, or does the models handle that automatically in the background?

Also, out of curiosity, do you believe GEE is better than linear mixed-effects models for parallel RCTs?

I think it is important to emphasize that in my simulation, I used time as a continuous variable with only a random intercept and no random slope. The calculations were based only on p

I have attached a PASS report showing an increase in power with more than seven measurements. To reiterate, the primary issue I’m highlighting is the transition from two to three measurements.

Thank you, Mark. Do you think any particular structure is superior for an RCT with two, three, or four follow-up measurements? This would be helpful for pre-registration in such cases.

I actually previously assumed that LME used compound symmetry in the background!

I don’t think that is possible without a significant lack of fit of AR(1).

Yes and if you want to hedge your bets regarding goodness of fit of the correlation structure use Markov models with random intercepts.

For Markov you specify how the current observations depend on past observations from the same subject. For generalized least squares you specify the correlation structure and get maximum likelihood estimates of the parameters of that structure (one parameter for AR(1)).

No. GEE can be inaccurate in estimating regression coefficients by assuming a nonsense working independence model. And GEE requires that dropouts and missing data are missing completely at random. Full modeling methods only require the missing at random assumption.

1 Like

@JorgeTeixeira when analyzing data with baseline (pre-treatment) and multiple post-treatment time points, I prefer to use an AR(1) structure as a starting point. It logically/clinically makes sense and is why there is the long standing issue of using lme4.

If, for some reason, your actual data do not meet those assumptions, you can then explore alternatives, but if you need to pre-specify these details in an SAP, AR(1) is what I would use.

With respect to the older lme() function in the nlme package that is part of Base R + Recommended packages, the description of the “correlation” argument in the documentation is as follows:

an optional corStruct object describing the within-group correlation structure. See the documentation of corClasses for a description of the available corStructclasses. Defaults to NULL, corresponding to no within-group correlations.

Apparently, over time, the last sentence regarding the default has led to confusion, with some interpretations being unstructured and others being independence.

Finding what would reasonably be considered the definitive reference from 1998 by Jose and Doug:

https://www.stat.cmu.edu/~brian/720-2007-source/week07-08-ideas/pinheiro98mixedeffects-Sguide.pdf

on the bottom of page 19 is the following:

The optional argument correlation is used to specify a correlation structure and the optional argument weights is used for variance functions. By default, the within-group errors are assumed to independent and homoscedastic.

so that might help to mitigate some of the confusion. It is also why I have never used the default, and prefer to explicitly define these details.

1 Like