Skip to content
Prev 3424 / 5632 Next

[R-meta] Time as indicator vs time as meaning

While Stefanou contacted me off-list and also shared the data with me, I want to bring this back here.

So, now that I have seen the data, I see that the "time_wthn" and "time_btw" variables were computed based on the measurenent occasion counter (time), not the time variable itself (time_wk). That mixes different things and of course then the results are not the same. So, using your data, do the following:

dat$time_btw <- ave(dat$time_wk, dat$study, FUN=mean)
dat$time_wthn <- dat$time_wk - dat$time_btw
dat$time_wthn <- round(dat$time_wthn, 8)

and then run:

model1 <- rma.mv(yi ~ time_btw + time_wthn, vi,
                 random = list(~ time_wthn | study, ~time_wk | study),
                 struct = c("GEN","CAR"), data=dat)

model2 <- rma.mv(yi ~ time_btw + time_wthn, vi,
                 random = list(~ time_wthn | study, ~time_wthn | study),
                 struct = c("GEN","CAR"), data=dat)

model1
model2

which yields:

Variance Components:

outer factor: study      (nlvls = 49)
inner term:   ~time_wthn (nlvls = 44)                                                                                 

            estim    sqrt  fixed  rho:  intr    tm_w 
intrcpt    0.4685  0.6845     no           -  1.0000 
time_wthn  0.0229  0.1513     no          no       - 

outer factor: study   (nlvls = 49)
inner factor: time_wk (nlvls = 12)

            estim    sqrt  fixed 
gamma^2    0.0603  0.2456     no 
phi        0.0295             no 

for model1 and the same for model2. So all is as expected.

profile(model1) also indicates peaks at all the estimates. And yes, that estimate of rho drifts towards 1. Not nice when that happens, but that's where the peak of the likelihood surface is.

I also see in the data now that there are at times multiple effects at the same time point. So one could even extend the model above further, for example with:

dat$obs <- 1:nrow(dat)

model3 <- rma.mv(yi ~ time_btw + time_wthn, vi,
          random = list(~ time_wthn | study, ~time_wk | study, ~ 1 | obs),
          struct = c("GEN","CAR"), data=dat)
model3

This further improves the fit:

anova(model1, model3)

These are some suggestions - I have not looked more deeply into these data. And my comment from before stands: You probably need a proper V matrix, not just the sampling variances (vi) if these effects are measured in the same people within studies.

One final thing: The line

dat$time_wthn <- round(dat$time_wthn, 8)

is a bit weird and seems unncessary. Well, I just got screwed by floating point issues. There is a part in rma.mv() where I figure out the *unique* time point values for struct="CAR" and use unique() for that. In essence, this is what happens:

unique(c(1/2, sqrt(1/2)*sqrt(1/2)))

Argh. Rounding time_wthn a bit solves that issue here. Of course, that needs to be fixed eventually in rma.mv() itself.

Best,
Wolfgang