caterpillars | R Documentation |
Using a metafor model object of class rma
or rma.mv
or a results table of class orchard
, this function produces a caterpillar plot from mean effect size estimates for all levels of a given categorical moderator, their corresponding confidence intervals, and prediction intervals.
caterpillars(
object,
mod = "1",
group,
xlab,
overall = TRUE,
transfm = c("none", "tanh"),
colerrorbar = "#00CD00",
colpoint = "#FFD700",
colpoly = "red",
k = TRUE,
g = TRUE,
at = NULL,
by = NULL,
weights = "prop"
)
object |
Model object of class |
mod |
The name of a moderator variable. Otherwise, "1" for an intercept-only model. |
group |
The grouping variable that one wishes to plot beside total effect sizes, k. This could be study, species, or whatever other grouping variable one wishes to present sample sizes for. |
xlab |
The effect size measure label. |
overall |
Logical, indicating whether to re-label "Intrcpt" (the default label from |
transfm |
If set to |
colerrorbar |
Colour of the error bar in the caterpillars plot. Defaults to hex code - "#00CD00". |
colpoint |
Point estimate colour in the caterpillars plot. Defaults to hex code - "#FFD700". |
colpoly |
Polygon colour in the caterpillars plot. Defaults to "red". |
k |
If |
g |
If |
at |
Used when one wants marginalised means. List of levels one wishes to predict at for the corresponding variables in |
by |
Used when one wants marginalised means. Character vector indicating the name that predictions should be conditioned on for the levels of the moderator. |
weights |
Used when one wants marginalised means. How to marginalize categorical variables. The default is |
Caterpillars plot
Shinichi Nakagawa - s.nakagawa@unsw.edu.au
Daniel Noble - daniel.noble@anu.edu.au
## Not run:
data(eklof)
eklof<-metafor::escalc(measure="ROM", n1i=N_control, sd1i=SD_control,
m1i=mean_control, n2i=N_treatment, sd2i=SD_treatment, m2i=mean_treatment,
data=eklof)
# Add the unit level predictor
eklof$Datapoint<-as.factor(seq(1, dim(eklof)[1], 1))
# fit a MLMR - accouting for some non-independence
eklof_MR<-metafor::rma.mv(yi=yi, V=vi, mods=~ Grazer.type-1, random=list(~1|ExptID,
~1|Datapoint), data=eklof)
results <- mod_results(eklof_MR, mod = "Grazer.type", group = "First.author")
caterpillars(results, mod = "Grazer.type",
group = "First.author", xlab = "log(Response ratio) (lnRR)", g = FALSE)
# Example 2
data(lim)
lim$vi<- 1/(lim$N - 3)
lim_MR<-metafor::rma.mv(yi=yi, V=vi, mods=~Phylum-1, random=list(~1|Article,
~1|Datapoint), data=lim)
results_lim <- mod_results(lim_MR, mod = "Phylum", group = "Article")
caterpillars(results_lim, mod = "Phylum",
group = "Article", xlab = "Correlation coefficient", transfm = "tanh")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.