| autoplot.predictmeans | R Documentation |
autoplot() draws a predictmeans result as a ggplot2 object: the means with one LSD
bar (as predictmeans 1.x), as bars, as horizontal confidence intervals, or the pairwise p-values.
plot() draws the same and prints it. summary() prints the means with a footer that states the
degrees of freedom, the SED and LSD ranges, the p-value adjustment and the covariate values used. All are built
from the means and pairs tables of the result: they do not compute statistics, so they can be used
in reports and Shiny apps (e.g. renderPlot(autoplot(pm))) or made interactive with
plotly::ggplotly(). Titles, labels and font sizes are changed with ggplot2, e.g.
autoplot(pm) + labs(title = "Yield") + theme_bw(14).
## S3 method for class 'predictmeans'
autoplot(object, type = c("means", "bar", "ci", "pvalue"),
interval = c("lsd", "sed", "ci", "comparison", "none"),
scale = c("auto", "model", "response"),
data = FALSE, x = NULL, group = NULL, panel = NULL,
scales = c("fixed", "free_y"), lines = TRUE,
jitter = 0.1, values = FALSE, ...)
## S3 method for class 'predictmeans'
plot(x, ...)
## S3 method for class 'predictmeans'
summary(object, digits = 4, ...)
## S3 method for class 'summary.predictmeans'
print(x, ...)
object |
A result of |
type |
|
interval |
For |
scale |
|
scales |
For |
data |
Add the observations ( |
x, group, panel |
Names of factors of |
lines |
For |
jitter |
Horizontal jitter of the data points, in units of the x categories. |
values |
For |
digits |
Number of significant digits printed (plus two). |
... |
For |
autoplot() returns a ggplot object; plot() prints it and returns it invisibly;
summary() returns an object whose print method shows the table and footer.
Dongwen Luo, Siva Ganesh and John Koolaard
predictmeans, tidy.predictmeans, pm_data, advice
library(predictmeans)
Oats <- as.data.frame(nlme::Oats)
Oats$nitro <- factor(Oats$nitro)
fm <- lmer(yield ~ nitro*Variety + (1|Block/Variety), data = Oats)
pm <- predictmeans(fm, "nitro:Variety", atvar = "Variety", adj = "tukey")
summary(pm)
ggplot2::autoplot(pm)
ggplot2::autoplot(pm, data = TRUE)
ggplot2::autoplot(pm, type = "bar")
ggplot2::autoplot(pm, type = "ci")
ggplot2::autoplot(pm, type = "pvalue")
plot(predictmeans(fm, "nitro:Variety"), xvar = "Variety", group = "nitro")
fl <- lm(log(yield) ~ nitro * Variety, data = Oats)
ggplot2::autoplot(predictmeans(fl, "nitro:Variety"), type = "ci", data = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.