\title{studies on the length of hospital stay of stroke patients}
\description{results from 9 studies on the length of the hospital stay of stroke patients under specialized care and under conventional/routine (non-specialist) care.}
\bold{source}   \tab \code{character} \tab source of data \cr
\bold{n1i}      \tab \code{numeric}   \tab number of patients under specialized care \cr
\bold{m1i}      \tab \code{numeric}   \tab mean length of stay (in days) under specialized care \cr
\bold{sd1i}     \tab \code{numeric}   \tab standard deviation of the length of stay under specialized care \cr
\bold{n2i}      \tab \code{numeric}   \tab number of patients under routine care \cr
\bold{m2i}      \tab \code{numeric}   \tab mean length of stay (in days) under routine care \cr
\bold{sd2i}     \tab \code{numeric}   \tab standard deviation of the length of stay under routine care
the 9 studies provide data in terms of the mean length of the hospital stay (in days) of stroke patients under specialized care and under conventional/routine (non-specialist) care. the goal of the meta-analysis was to examine the hypothesis whether specialist stroke unit care will result in a shorter length of hospitalization compared to routine management.
### calculate mean differences and corresponding sampling variances
dat <- escalc(measure="md", m1i=m1i, sd1i=sd1i, n1i=n1i, m2i=m2i, sd2i=sd2i, n2i=n2i, data=dat)
### meta-analysis of mean differences using a random-effects model
### meta-analysis of standardized mean differences using a random-effects model
res <- rma(measure="smd", m1i=m1i, sd1i=sd1i, n1i=n1i, m2i=m2i, sd2i=sd2i, n2i=n2i,
dat <- escalc(measure="rom", m1i=m1i, sd1i=sd1i, n1i=n1i, m2i=m2i, sd2i=sd2i, n2i=n2i, data=dat)
### meta-analysis of the (log transformed) ratios of means using a random-effects model
medicine, raw mean differences, standardized mean differences

\title{studies on the relationship between bmi and risk of preeclampsia}
\description{results from 13 studies on the relationship between maternal body mass index (bmi) and the risk of preeclampsia.}
\bold{study}      \tab \code{numeric}    \tab study id \cr
\bold{author}     \tab \code{character}  \tab (first) author of the study \cr
\bold{ref}        \tab \code{numeric}    \tab reference number \cr
\bold{ch}         \tab \code{character}  \tab exclusion due to chronic hypertension (yes/no) \cr
\bold{dm}         \tab \code{character}  \tab exclusion due to diabetes mellitus (yes/no) \cr
\bold{mg}         \tab \code{character}  \tab exclusion due to multiple gestation (yes/no) \cr
\bold{bmi.lb}     \tab \code{numeric}    \tab lower bound of the bmi interval \cr
\bold{bmi.ub}     \tab \code{numeric}    \tab upper bound of the bmi interval \cr
\bold{bmi}        \tab \code{numeric}    \tab midpoint of the bmi interval \cr
\bold{cases}      \tab \code{numeric}    \tab number of preeclampsia cases in the bmi group \cr
\bold{total}      \tab \code{numeric}    \tab number of individuals in the bmi group
the dataset includes the results from 13 studies examining the relationship between maternal body mass index (bmi) and the risk of preeclampsia. for each study, results are given in terms of the number of preeclampsia cases within two or more groups defined by the lower and upper bmi bounds as shown in the dataset (\code{na} means that the interval is either open to the left or right). the \code{bmi} variable is the interval midpoint as defined by o'brien et al. (2003).
o'brien, t. e., ray, j. g., & chan, w.-s. (2003). maternal body mass index and the risk of preeclampsia: a systematic overview. \emph{epidemiology}, \bold{14}(3), 368--374. \verb{https://doi.org/10.1097/00001648-200305000-00020}
### restructure the data into a wide format
dat2 <- to.wide(dat, study="study", grp="grp", ref=1, grpvars=c("bmi","cases","total"),
dat2 <- escalc(measure="rr", ai=cases1, n1i=total1, ci=cases2, n2i=total2, data=dat2)
with(dat2, forest(yi, vi, slab=slabs, xlim=c(-7,5.5), cex=0.8,
psize=1, pch=19, efac=0, rows=rows, ylim=c(0,max(rows)+3), yaxs="i",
text(-4.4, max(rows)+2, "comparison", font=2, cex=0.8, pos=4)
### within-study mean center the bmi variable
dat$bmicent <- with(dat, bmi - ave(bmi, study))
### compute the proportion of preeclampsia cases and corresponding sampling variances
dat <- escalc(measure="pr", xi=cases, ni=total, data=dat)
### convert the proportions to percentages (and convert the variances accordingly)
### fit multilevel meta-regression model to examine the relationship between the
### (centered) bmi variable and the risk of preeclampsia
res <- rma.mv(yi, vi, mods = ~ bmicent, random = ~ 1 | study/grp, data=dat)
### draw scatterplot with regression line
regplot(res, xlab=expression("within-study mean centered bmi"~(kg/m^2)),
ylab="preeclampsia prevalence (\%)", las=1, bty="l",
### fit model using a random slope for bmicent
res <- rma.mv(yi, vi, mods = ~ bmicent, random = ~ bmicent | study, struct="gen", data=dat)
res <- rma.mv(yi, vi, mods = ~ rcs(bmicent, 4), random = ~ 1 | study/grp, data=dat)
knots <- attr(rcs(model.matrix(res)[,2], 4), "parms")
### computed predicted values based on the model
sav <- predict(res, newmods=rcspline.eval(xs, knots, inclx=true))
### draw scatterplot with regression line based on the model
xvals=xs, xlab=expression("within-study mean centered bmi"~(kg/m^2)),
medicine, obstetrics, risk ratios, proportions, multilevel models, dose-response models