[R-meta] Substitute metafor fit for lm fit

Reza Norouzian rnorouz|@n @end|ng |rom gm@||@com
Fri Feb 4 16:40:28 CET 2022


Dear Simon,

To briefly comment on this, no, at least not easily so. lm() doesn't
store its vcov() in the lm() object. Rather it computes it via its
summary method, kind of on the fly.

If you have to do this, you probably want to look into the gls()
function from the nlme package, making sure that the default behaviors
of both functions agree (e.g., how they handle NAs, singular models
etc.).

Kind regards,
Reza

On Thu, Jan 13, 2022 at 11:38 AM Simon Harmel <sim.harmel using gmail.com> wrote:
>
> Hello Wolfgang,
>
> A quick question. Is it possible to substitute the vcov(rma.mv_fit)
> into a vcov(lm_fit)?
>
> Thank you,
> Simon
>
> # An Example:
> library(metafor)
>
> dat2 <- escalc(measure="OR", ai=waward, n1i=wtotal, ci=maward,
> n2i=mtotal, data=dat.bornmann2007)
>
> res1 <- rma.mv(yi ~ 0+type, vi, random = ~ 1 | study/obs, data=dat2)
>
> res2 <- lm(yi ~ 0+type, data = dat2)
>
> vcov(res2) <- vcov(res1) ## apparently this won't work!
>
> _______________________________________________
> R-sig-meta-analysis mailing list
> R-sig-meta-analysis using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis



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