Skip to content
Back to formatted view

Raw Message

Message-ID: <CAKt3tzke6OU3bHdDW6Se96NoR5wbk8POpLVg5qK=URz49bFz1Q@mail.gmail.com>
Date: 2022-02-04T15:40:28Z
From: Reza Norouzian
Subject: [R-meta] Substitute metafor fit for lm fit
In-Reply-To: <CACgv6yX_5ybyxVU5JyayDegwy=YLt6rL0nz61OnManfGz5w-4A@mail.gmail.com>

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 at 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 at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis