[R-meta] Question metafor network meta-analysis with multiple time points

Gerjon Hannink gerjonh@nn|nk @end|ng |rom gm@||@com
Fri Nov 22 08:37:52 CET 2024


Dear Wolfgang,

Thank you for your detailed answer, I really appreciate the time and effort you put into explaining this. 
I'll try the options you suggested and come back if needed.

Thanks again & have a nice weekend!

Best regards,
Gerjon




> On 21 Nov 2024, at 19:17, Viechtbauer, Wolfgang (NP) <wolfgang.viechtbauer using maastrichtuniversity.nl> wrote:
> 
> Thanks for the clarification. Okay, so using dat.hasselblad1998 as an example, the contrast-based network meta-analysis would be conducted with:
> 
> rma.mv(yi, V, mods = ~ 0 + self_help + ind_counseling + grp_counseling,
>       random = ~ comp | study, rho=1/2, data=dat)
> 
> as illustrated in the docs:
> 
> https://wviechtb.github.io/metadat/reference/dat.hasselblad1998.html
> 
> I assume that time is meaningfully comparable across studies (e.g., time 1 reflects post intervention, time 2 some shorter follow-up, and 3 some longer follow-up). Then we could start by estimating timepoint specific treatment effects with:
> 
> mods = ~ 0 + (self_help + ind_counseling + grp_counseling):factor(time)
> 
> If certain treatments have not been examined at all timepoints, then some effects will not be estimable, so these will automatically drop out of the model.
> 
> We also need to consider V. Multiple contrast estimates computed for the same two groups of subjects at different times will be correlated. One could assume that estimates are autocorrelated according to an AR(1) structure. In addition, if a particular group serves as the same reference group for multiple contrasts, then this also induces dependency. The vcalc() function is designed to help you create an appropriate V matrix that takes these various sources of dependency into consideration. I think that for the example you provided below, the following would be correct:
> 
> vcalc(vi, cluster=study, time1=c(1,2,3, 1,2,1,2,1,2), time2=c(1,2,3, 1,2,1,2,1,2),
>                         grp1= c(1,1,1, 1,1,2,2,1,1), grp2= c(2,2,2, 2,2,3,3,3,3), phi=?)
> 
> phi here is the autocorrelation coefficient, which you would have to make an educated guess about. Using argument 'w1' and 'w2' one can refine the computation of the covariances a bit, but I'll skip this part.
> 
> The next thing to consider is the random effects structure. A possibly sensible starting point would be to have the same random effects structure at the study level and at the timepoint within study level, so:
> 
> dat$study.time <- paste0(dat$study, ".", dat$time)
> random = list(~ comp | study, ~ comp | study.time), rho=1/2, phi=1/2
> 
> While this 'random = ~ comp | study, rho=1/2' business is all well and reasonable, one could also just simply use a plain hierarchical structure of the form:
> 
> random = ~ 1 | study/comp/time
> 
> The latter is also a bit more amendable to considering an autoregressive structure for the random effects, that is, we add random effects at the study and comparison level and then autocorrelated random effects for the various timepoints within comparisons; for example:
> 
> dat$study.comp <- paste0(dat$study, ".", dat$comp)
> random = list(~ 1 | study/comp, ~ time | study.comp), struct="AR"
> 
> or struct="HAR" if there is sufficient data to estimate timepoint specific variances.
> 
> These are at least some ideas I would try with such data. And robust(res, cluster=study, clubSandwich=TRUE) is always an additional thing I would run on any fitted model to see how much results will differ.
> 
> Best,
> Wolfgang
> 
>> -----Original Message-----
>> From: Gerjon Hannink <gerjonhannink using gmail.com>
>> Sent: Thursday, November 21, 2024 14:22
>> To: Viechtbauer, Wolfgang (NP) <wolfgang.viechtbauer using maastrichtuniversity.nl>
>> Cc: R Special Interest Group for Meta-Analysis <r-sig-meta-analysis using r-
>> project.org>
>> Subject: Re: [R-meta] Question metafor network meta-analysis with multiple time
>> points
>> 
>> Dear Wolfgang,
>> 
>> I'm using a contrast-based approach. My data structure looks like (modified from
>> 'dat.hasselblad1998'):
>> 
>>        authors year                               trt time   TE seTE
>>    Reid et al. 1974     no_contact vs. ind_counseling    1  ...  ...
>>    Reid et al. 1974     no_contact vs. ind_counseling    2  ...  ...
>>    Reid et al. 1974     no_contact vs. ind_counseling    3  ...  ...
>> Cottraux et al. 1983     no_contact vs. ind_counseling    1  ...  ...
>> Cottraux et al. 1983     no_contact vs. ind_counseling    2  ...  ...
>> Cottraux et al. 1983 ind_counseling vs. grp_counseling    1  ...  ...
>> Cottraux et al. 1983 ind_counseling vs. grp_counseling    2  ...  ...
>> Cottraux et al. 1983     no_contact vs. grp_counseling    1  ...  ...
>> Cottraux et al. 1983     no_contact vs. grp_counseling    2  ...  ...
>>                 ...                               ...  ...  ...  ...
>> 
>> Thanks & best regards,
>> Gerjon
>> 
>> On Thu, Nov 21, 2024 at 1:05 PM Viechtbauer, Wolfgang (NP)
>> <mailto:wolfgang.viechtbauer using maastrichtuniversity.nl> wrote:
>> Dear Gerjon,
>> 
>> Can you show what your data structure looks like? You don't have to show the
>> actual data, but it would help to know how the data are structured. Like:
>> 
>> Study Time Trt
>> --------------
>> ?     ?    ?
>> ...
>> 
>> And are you using a contrast- or an arm-based approach for conducting your
>> network meta-analysis?
>> 
>> Best,
>> Wolfgang
>> 
>>> -----Original Message-----
>>> From: R-sig-meta-analysis <mailto:r-sig-meta-analysis-bounces using r-project.org>
>> On Behalf
>>> Of Gerjon Hannink via R-sig-meta-analysis
>>> Sent: Wednesday, November 20, 2024 16:25
>>> To: mailto:r-sig-meta-analysis using r-project.org
>>> Cc: Gerjon Hannink <mailto:gerjonhannink using gmail.com>
>>> Subject: [R-meta] Question metafor network meta-analysis with multiple time
>>> points
>>> 
>>> Hi all,
>>> 
>>> I have a `metafor` question, and hope you can help me out. I was
>>> thinking of (and struggling with) how I would do a network
>>> meta-analysis with studies with measurements at multiple time points
>>> using `http://rma.mv` from the `metafor` -package. Would that be possible?
>>> 
>>> In many presentations (e.g. provided on
>>> https://www.wvbauer.com/doku.php/presentations) I find 'multiple time
>>> points' and 'network meta-analysis'. In these examples, the following
>>> is used, e.g.,
>>> 
>>> `res <- http://rma.mv(yi, V, mods = ~ factor(time) - 1, data = dat.long,
>>> random = ~ time | study, struct = "HAR")` and
>>> `res <- http://rma.mv(yi, vi, mods = ~ trt, data = dat, random = ~ 1 |
>>> study/trt)`, respectively.
>>> 
>>> Would it be as simple as just combining the two? I guess it is not
>>> that simple...
>>> 
>>> I played a bit using something like:
>>> 
>>> http://rma.mv(yi, V, mods = ~ factor(time) * trt , data = dat.long, random =
>>> ~ time | study/trt)
>>> 
>>> But this returned an error message 'Cannot use '~ inner |
>>> outer1/outer2' type terms in the 'random' argument'.
>>> I guess I would also need to modify V a bit to take all necessary
>>> variances/covariance into account...
>>> And what about `struct`?
>>> 
>>> Thanks for your help & looking forward to hearing your thoughts!
>>> 
>>> Best regards,
>>> Gerjon



More information about the R-sig-meta-analysis mailing list