[R-meta] margins command

Patricia Ziegelmann p@tr|c|@kz99 @end|ng |rom gm@||@com
Fri Mar 10 11:51:43 CET 2023


Dear Wolfgang,

Thanks for your work in metafor and for your kind reply to my question.

Best

Patricia

Em qui., 9 de mar. de 2023 às 12:51, Viechtbauer, Wolfgang (NP) <
wolfgang.viechtbauer using maastrichtuniversity.nl> escreveu:

> Dear Patricia,
>
> To start: 'sei = vi' looks wrong. Argument 'sei' is for passing the
> standard errors to the rma() function, but 'vi' sounds like a variable that
> contains sampling variances.
>
> This aside, the answer to your question is yes. You can do this with:
> predict(res, newmods=c(1,1), intercept=FALSE).
>
> As for marginal effects, you can use emmprep() together with the emmeans
> package (note that you will need to install the 'devel' version of metafor
> for this, since emmprep() was recent added;
> https://wviechtb.github.io/metafor/#installation).
>
> An example:
>
> library(metafor)
>
> dat <- dat.bangertdrowns2004
>
> res <- rma(yi, vi, mods = ~ wic + info, data=dat)
> res
>
> predict(res, newmods=c(1,1), intercept=FALSE)
>
> sav <- emmprep(res)
>
> library(emmeans)
>
> emmeans(sav, specs="1", weights="proportional")
>
> # this is identical to
> predict(res, newmods = colMeans(model.matrix(res))[-1], digits=3)
>
> # marginal means for 'wic' and 'info'
> emmeans(sav, specs="wic", weights="proportional")
> emmeans(sav, specs="info", weights="proportional")
>
> If you do not want proportional weights, then just leave out the
> 'weights="proportional"' part.
>
> Best,
> Wolfgang
>
> >-----Original Message-----
> >From: R-sig-meta-analysis [mailto:
> r-sig-meta-analysis-bounces using r-project.org] On
> >Behalf Of Patricia Ziegelmann via R-sig-meta-analysis
> >Sent: Thursday, 09 March, 2023 14:17
> >To: r-sig-meta-analysis using r-project.org
> >Cc: Patricia Ziegelmann
> >Subject: [R-meta] margins command
> >
> >Dear all,
> >
> >I´m adjusting a simple metaregression model:
> >
> >meta <- rma(yi = yi,
> >              sei = vi,
> >              mods = ~ risk1 + risk2,
> >              data = data1,
> >              method = "REML")
> >
> >Both risk1 and risk2 are binary factors.
> >
> >Is it possible to estimate a confidence interval for a function of the
> >fitted coefficients, let's say beta[1]+beta[2]?
> >
> >Also, is there a command like the "margins" to have marginal effects
> >summaries?
> >
> >Thanks in advance for any help,
> >
> >Patricia
> >
> >--
> >Patricia Klarmann Ziegelmann
> >Department of Statistics
> >Graduate Program in Epidemiology
> >Universidade Federal do Rio Grande do Sul (UFRGS)
> >http://lattes.cnpq.br/8486215358933890
> >Av. Bento Gonçalves, 9500 - Prédio 43-111 - Agronomia
> >91509-900 Porto Alegre - RS - BRAZIL
>


-- 
Patricia Klarmann Ziegelmann
Department of Statistics
Graduate Program in Epidemiology
Universidade Federal do Rio Grande do Sul (UFRGS)
http://lattes.cnpq.br/8486215358933890
Av. Bento Gonçalves, 9500 - Prédio 43-111 - Agronomia
91509-900 Porto Alegre - RS - BRAZIL

	[[alternative HTML version deleted]]



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