This is correct (for getting likelihood ratio tests). Manually setting a 
component to 0 is also the same as just leaving out the corresponding random 
effect. So, you could also do:

model2 <- rma.mv(y, v, random = list(~ 1 | y, ~ 1 | ID), data=dat)
model3 <- rma.mv(y, v, random = ~ 1 | y, data=dat)
model4 <- rma.mv(y, v, random = ~ 1 | ID, data=dat)
anova(model2,model3)
anova(model2,model4)

That should give you identical results.

At the moment, rma.mv() does not compute SEs for the variance components. It 
may at some point in the future, but it is unclear what one would do with those 
SEs. Wald-type tests (z-tests) should generally be avoided when testing 
variance components.

Best,
Wolfgang

--    
Wolfgang Viechtbauer, Ph.D., Statistician    
Department of Psychiatry and Neuropsychology    
School for Mental Health and Neuroscience    
Faculty of Health, Medicine, and Life Sciences    
Maastricht University, P.O. Box 616 (VIJV1)    
6200 MD Maastricht, The Netherlands    
+31 (43) 388-4170 | http://www.wvbauer.com    

> -----Original Message-----
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Carlijn
> Wibbelink
> Sent: Tuesday, April 21, 2015 10:43
> To: li...@dewey.myzen.co.uk; r-help@r-project.org
> Subject: Re: [R] Metafor - rma.mv function - variance components
> 
> Thank you for your reaction, it worked.
> However, I'm wondering if this is the right way to test whether there is
> significant variation on one of the two levels. The results of the anova
> tests do not correspond to the results of the Z-test in metaSEM. (In
> metaSEM only one of the variances is significant, but when I use the
> anova test in metafor, both variances are significant). But maybe I made
> a mistake. This is my syntax:
> model2 <- rma.mv(y, v, random = list(~ 1 | y, ~ 1 | ID), data=dat)
> model3 <- rma.mv(y, v, random = list(~ 1 | y, ~ 1 | ID), sigma2=c(NA,0),
> data=dat)
> model4 <- rma.mv(y, v, random = list(~ 1 | y, ~ 1 | ID), sigma2=c(0,NA),
> data=dat)
> anova(model2,model3)
> anova(model2,model4)
> 
> Is it possible to receive the standard errors of the variances in metafor
> (and do a Z-test)?
> 
> > To: wibbelt...@hotmail.com; r-help@r-project.org
> > Subject: Re: [R] Metafor - rma.mv function - variance components
> > From: li...@dewey.myzen.co.uk
> > Date: Mon, 20 Apr 2015 20:24:48 +0000
> >
> > Carlijn Wibbelink <wibbelt...@hotmail.com> wrote :
> >
> > Dear Carlijn
> > I think that if you set sigma2 to a vector of length 2 it will be
> possible.
> >
> > > Hi all,
> > >
> > > I have a question about metafor and the rma.mv function. I have
> fitted a
> > > multivariate model (effect sizes are nested within studies) and I've
> found two
> > > variances:
> > >
> > > Variance Components:
> > >                       estim    sqrt     nlvls  fixed  factor
> > > sigma^2.1  0.0257  0.1602     72     no       y
> > > sigma^2.2  0.0694  0.2635     10     no      ID
> > >
> > > I want to test whether there is significant variantion between the
> effect sizes
> > > within studies (sigma^2.1: 0.0257) and/or between studies (sigma^2.2:
> 0.0694).
> > > In metaSEM you can fix for example the variance within studies
> (sigma^2.1) to
> > > zero to test whether there is a significant difference in fit between
> the models
> > > (and if so, then there is significant heterogeneity between the
> effect sizes
> > > within studies). I was wondering if this is also possible in metafor.
> If I fix
> > > sigma2 to zero, then both variances are fixed to zero. However, I
> want to fix
> > > only one variance to zero.
> > > I hope that someone can help me. Thank you in advance!
> > >
> > >   [[alternative HTML version deleted]]
> > >
> > > ______________________________________________
> > > R-help@r-project.org
> > > mailing list -- To UNSUBSCRIBE and more, see
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> > > and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to