[R-meta] Adjusted effects p- and z-value

Lena Pollerhoff |en@ @end|ng |rom po||erho||@de
Thu Jul 7 14:22:45 CEST 2022


Dear Wolfgang,

Thank you so much for your quick response! 

I assume it is also possible to calculate the p- and z-values with the anova function for the mean of a dummy variable in case of a categorical predictor, e.g. anova(res,X=c(1,colMeans(model.matrix(categorical_moderator))[-1])) ? 

Further what would the best way to cite your online tutorials like the one for the adjusted effects? 

Best wishes 
Lena 

> Am 07.07.2022 um 10:14 schrieb Viechtbauer, Wolfgang (NP) <wolfgang.viechtbauer using maastrichtuniversity.nl>:
> 
> Hi Lena,
> 
> See below for my responses.
> 
> Best,
> Wolfgang
> 
>> -----Original Message-----
>> From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-project.org] On
>> Behalf Of Lena Pollerhoff
>> Sent: Thursday, 07 July, 2022 8:01
>> To: r-sig-meta-analysis using r-project.org
>> Subject: [R-meta] Adjusted effects p- and z-value
>> 
>> Hey everyone,
>> 
>> I’m currently computing adjusted effects based on meta-regression models (based
>> on this tutorial https://www.metafor-
>> project.org/doku.php/tips:computing_adjusted_effects <https://www.metafor-
>> project.org/doku.php/tips:computing_adjusted_effects>).
>> When I am computing the effect with predict(res, newmods = mean(continuous
>> variable)) I receive the estimated average effect size (pred), the CI and PI.
>> Now I was wondering whether it would be also possible to receive the p-value and
>> z-value for the adjusted effect (similar to the output of a random-effect model)?
> 
> You can use anova() for this. Using the same example from the tutorial:
> 
> predict(res, newmods = mean(dat$ablat), transf=exp, digits=2)
> 
> anova(res, X = c(1,mean(dat$ablat)))
> 
> In contrast to predict() (where the 'intercept' argument controls whether the intercept is included in the linear contrast), with anova() this is done as part of X. Also, there is no 'transf' argument for anova(), but this is not relevant anyway, since the testing is done on the original (in this case, log) scale.
> 
>> Further I was wondering whether it is possible to include the PI in the forest
>> plot (as the dotted lines around the diamond shaped effect) when I am manually
>> including the adjusted effect in the forest plot with e.g.,
>> sav <- predict(res, newmods = mean(continuous variable))
>> Addpoly(sav$pred, sei=sav$se)
>> 
>> Normally one could add it with addpred = TRUE, but this does not work in this
>> specific case.
> 
> There is actually an addpoly() method for 'predict.rma' objects now. So you can do:
> 
> pred <- predict(res, newmods = mean(dat$ablat))
> addpoly(pred, addpred=TRUE)
> 
> For this to work, don't use transf=exp in predict(). If transf=exp was used as part of the call to forest(), then the addpoly() method will automatically use the same transformation automatically.
> 
> dat <- dat.bcg
> dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat,
>              slab=paste0(author, ", ", year))
> 
> res <- rma(yi, vi, data=dat)
> forest(res, xlim=c(-6.8,3.8), header=TRUE, top=2, atransf=exp, cex=0.9, addpred=TRUE,
>       at=log(c(1/16, 1/8, 1/4, 1/2, 1, 2, 4, 8)), digits=c(2L,4L), ylim=c(-2,15))
> res <- rma(yi, vi, mods = ~ ablat, data=dat)
> pred <- predict(res, newmods = mean(dat$ablat))
> addpoly(pred, addpred=TRUE)
> 
> I need to update the tutorial to show this.
> 
>> Thanks in advance and best wishes
>> Lena



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