[R-meta] metafor::escalc question: Confidence intervals for differences in standardized mean change -

Dale Steele d@|e@w@@tee|e @end|ng |rom gm@||@com
Sat May 15 13:20:42 CEST 2021


Correcting the last 3 lines of the previous message. The CIs
calculated as follows:

dat[c("ci_lb", "ci_ub")] <- dat$yi + c(-1,1) * (qnorm(1 - 0.025) * sqrt(dat$vi))


On Fri, May 14, 2021 at 2:47 PM Dale Steele <dale.w.steele using gmail.com> wrote:
>
> I'm following the example on the metafor website for Computing the
> Difference in the Standardized Mean Change
> <https://www.metafor-project.org/doku.php/analyses:morris2008>
>
> I'd like to calculate a confidence interval for each of the
> differences in the 'dat' dataframe, rather than calculating by hand as
> I have attempted below.  As illustrated below,  I tried to convert
> 'dat' back to an 'escalc' object with:
> new_dat <- escalc(measure = "GEN", dat, append = TRUE) with the hope
> that summary(new_dat) would generate the desired confidence intervals,
> but this failed with a "Error in as.vector(vi) : argument "vi" is
> missing, with no default" error.
>
> Is what I'm doing possible?.
>
> Thanks!
>
>
> Example below:
>
> datT <- data.frame(
>   m_pre   = c(30.6, 23.5, 0.5, 53.4, 35.6),
>   m_post  = c(38.5, 26.8, 0.7, 75.9, 36.0),
>   sd_pre  = c(15.0, 3.1, 0.1, 14.5, 4.7),
>   sd_post = c(11.6, 4.1, 0.1, 4.4, 4.6),
>   ni      = c(20, 50, 9, 10, 14),
>   ri      = c(0.47, 0.64, 0.77, 0.89, 0.44))
>
> datC <- data.frame(
>   m_pre   = c(23.1, 24.9, 0.6, 55.7, 34.8),
>   m_post  = c(19.7, 25.3, 0.6, 60.7, 33.4),
>   sd_pre  = c(13.8, 4.1, 0.2, 17.3, 3.1),
>   sd_post = c(14.8, 3.3, 0.2, 17.9, 6.9),
>   ni      = c(20, 42, 9, 11, 14),
>   ri      = c(0.47, 0.64, 0.77, 0.89, 0.44))
>
> datT <- escalc(measure="SMCR", m1i=m_post, m2i=m_pre, sd1i=sd_pre,
> ni=ni, ri=ri, data=datT)
> datC <- escalc(measure="SMCR", m1i=m_post, m2i=m_pre, sd1i=sd_pre,
> ni=ni, ri=ri, data=datC)
>
> summary(datT) #generates CI's for within-arm standardized differences
> summary(datC)
>
> dat <- data.frame(yi = datT$yi - datC$yi, vi = datT$vi + datC$vi)
> # dat is no longer an 'escalc' object
> # Next line fails with error
> new_dat <- escalc(measure = "GEN", dat, append = TRUE)
> dat$sei <- sqrt(dat$vi)
> dat$zi <- dat$yi/dat$sei
> dat$ci_lb <- dat$yi - dat$zi *dat$sei
> dat$ci_ub <- dat$yi + dat$zi *dat$sei



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