a wrapper to ggplot2 that generates a Harrel (or Horizontal) dot plot, with an upper panel of model contrasts and a lower panel of treatment distributions
1 2 3 4 5 6 7 8 9 10 11 | harrellplot(x, y, g = NULL, covcols = NULL, rintcols = NULL,
rslopecols = NULL, data, fit.model = "lm", REML = TRUE,
error = "Normal", add_interaction = TRUE, interaction.group = TRUE,
interaction.treatment = TRUE, mean_intervals.method = "raw",
conf.mean = 0.95, contrasts.method = "revpairwise",
contrasts.scaling = "raw", conf.contrast = 0.95, adjust = FALSE,
show.contrasts = TRUE, show.treatments = TRUE,
display.treatment = "box", short = FALSE, show.mean = TRUE,
show.dots = TRUE, zero = TRUE, horizontal = TRUE,
color_palette = "jco", jtheme = "minimal", rel_height = 0,
y_label = NULL)
|
x |
contains the name of the column of Treatment 1 – will be ploted on the X-axis |
y |
contains the name of the column with the response variable |
g |
contains the name of the column of Treatment 2 – will be the "grouping" variable for the plot |
data |
is the data frame or data.table |
fit.model |
at present, only "lm" and 'lmm' (using lme4) are implemented |
error |
at present, only "Normal" is implemented |
add_interaction |
if TRUE, include interaction effect |
interaction.group |
if TRUE, plots effects across levels of Treatment 2 |
interaction.treatment |
if TRUE, plots effects across levels of Treatment 1 |
mean_intervals.method |
method for computing confidence intervals of the treatment means. "raw" commputes the intervals based on the treatment SE, "lm" is based on the model SE from the fit model, "boot" computes bootstrap intervals |
conf.mean |
is the percentile level for the treatment CIs. Possible values are 0.9, 0.95, and 0.99 |
contrasts.method |
"coefficients" are the model coefficients. "trt.vs.ctrl1" and "revpairwise" are from the emmeans (formerly lsmeans) package. |
contrasts.scaling |
Scaling of the effects (if contrasts). Can be 'raw', 'percent', or 'standardized' |
conf.contrast |
is percentile level for the contrast CIs. Possible values are 0.9, 0.95, and 0.99 |
adjust |
is interval adjustment for contrast CIs, TRUE is default adjustment, which is Tukey for pairwise or modified Dunnets for treatment vs. control |
display.treatment |
can be "box", "ci" |
short |
if TRUE, treatment levels are shortened using abbreviate() |
show.mean |
if TRUE, plot mean |
show.dots |
if TRUE, plot dots |
horizontal |
if TRUE, the plot is flipped into horizontal geometry |
color_palette |
can be "ggplot", "greys", "npg", "aaas", "nejm", "lancet", "jama", "jco". greys is from color brewer. npg, aas, nejm, lancet, jama, and jco are from ggsci package. |
jtheme |
can be "gray", "bw", "classic", "minimal" |
rel_height |
Aspect ratio of forest plot vs. box/dot plot components. E.g .66 or 1.5. For default, either do not pass this parameter or us "rel_height=0". |
y_label |
user supplied lable for Y axis |
show.zero |
if TRUE, includes 0.0 on in the forest plot of effects |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.