orchard_plot | R Documentation |
Using a metafor model object of class rma
or rma.mv
, or a results table of class orchard
, it creates an orchard plot from mean effect size estimates for all levels of a given categorical moderator, and their corresponding confidence and prediction intervals.
orchard_plot(
object,
mod = "1",
group,
xlab,
N = NULL,
alpha = 0.5,
angle = 90,
cb = TRUE,
k = TRUE,
g = TRUE,
tree.order = NULL,
trunk.size = 0.5,
branch.size = 1.2,
twig.size = 0.5,
transfm = c("none", "tanh", "invlogit", "percent", "percentr"),
condition.lab = "Condition",
legend.pos = c("bottom.right", "bottom.left", "top.right", "top.left", "top.out",
"bottom.out", "none"),
k.pos = c("right", "left", "none"),
colour = FALSE,
fill = TRUE,
weights = "prop",
by = NULL,
at = NULL,
upper = TRUE,
flip = TRUE
)
object |
model object of class |
mod |
the name of a moderator. Defaults to |
group |
The grouping variable that one wishes to plot beside total effect sizes, k. This could be study, species, or any grouping variable one wishes to present sample sizes for. Not needed if an |
xlab |
The effect size measure label. |
N |
The name of the column in the data specifying the sample size so that each effect size estimate is scaled to the sample size, N. Defaults to |
alpha |
The level of transparency for effect sizes represented in the orchard plot. |
angle |
The angle of y labels. The default is 90 degrees. |
cb |
If |
k |
If |
g |
If |
tree.order |
Order in which to plot the groups of the moderator when it is a categorical one. Should be a vector of equal length to number of groups in the categorical moderator, in the desired order (bottom to top, or left to right for flipped orchard plot) |
trunk.size |
Size of the mean, or central point. |
branch.size |
Size of the confidence intervals. |
twig.size |
Size of the prediction intervals. |
transfm |
If set to |
condition.lab |
Label for the condition being marginalized over. |
legend.pos |
Where to place the legend. To remove the legend, use |
k.pos |
Where to put k (number of effect sizes) on the plot. Users can specify the exact position or they can use specify |
colour |
Colour of effect size shapes. By default, effect sizes are colored according to the |
fill |
If |
weights |
Used when one wants marginalised means. How to marginalize categorical variables. The default is |
by |
Character vector indicating the name that predictions should be conditioned on for the levels of the moderator. |
at |
List of levels one wishes to predict at for the corresponding varaibles in 'by'. Used when one wants marginalised means. This argument can also be used to suppress levels of the moderator when argument |
upper |
Logical, defaults to |
flip |
Logical, defaults to |
Orchard 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 - accounting 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 = "ExptID")
orchard_plot(results, mod = "Grazer.type",
group = "ExptID", xlab = "log(Response ratio) (lnRR)")
# or
orchard_plot(eklof_MR, mod = "Grazer.type", group = "ExptID",
xlab = "log(Response ratio) (lnRR)")
# 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)
orchard_plot(lim_MR, mod = "Phylum", group = "Article",
xlab = "Correlation coefficient", transfm = "tanh", N = "N")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.