Description Usage Arguments Value Examples
Useful to visualize results from regression type analyses, as it shows the estimate, confidence interval, and optionally use the value of the p.value to highlight significant associations. A vertical line is included
1 2 3 4 5 |
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
stat |
The statistical transformation to use on the data for this layer, as a string. |
position |
Position adjustment, either as a string, or the result of a call to a position adjustment function. |
... |
other arguments passed on to |
height |
Add ends to the confidence intervals. |
fatten |
A multiplicative factor used to increase the size of the
middle bar in |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
center.linetype |
The linetype for the center line. |
center.linecolour |
Line colour for the center line. |
center.linesize |
Line size for the center line. |
ci.linesize |
Line size for the confidence interval lines. |
inherit.aes |
If |
Adds a ggplot2 geom layer.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | library(ggplot2)
library(broom)
fit <- lm(Fertility ~ 0 + Catholic + Agriculture + Examination +
Education + Infant.Mortality, data = swiss)
fit <- tidy(fit, conf.int = TRUE)
fit <- transform(fit, model = "non-log", p.value = discrete_pvalue(fit$p.value))
p <- ggplot(fit, aes(x = estimate, y = term, xmin = conf.low, xmax = conf.high))
p + geom_estci()
p + geom_estci(aes(xintercept = 1.1), center.linecolour = "red")
p + geom_estci(aes(size = p.value), linetype = "dotted")
p + geom_estci(aes(colour = p.value, size = p.value), linetype = "dotted")
p + geom_estci(aes(colour = p.value, size = p.value), linetype = "dotted") +
scale_colour_grey(start = 0.75, end = 0)
p + geom_estci(aes(size = p.value, alpha = p.value), linetype = "dotted")
p + geom_estci(aes(size = p.value, alpha = p.value, colour = p.value))
p + geom_estci(aes(alpha = p.value), linetype = "dashed",
center.linetype = "solid")
p + geom_estci(aes(alpha = p.value, xintercept = 1),
colour = "blue", linetype = "dashed", center.linetype = "solid")
p + geom_estci(aes(alpha = p.value, xintercept = 1), center.linesize = 1.5)
p + geom_estci(center.linesize = 0.25, height = 1, fatten = 2)
p + geom_estci(center.linesize = 2, height = 0.5, fatten = 8)
p + geom_estci(ci.linesize = 3)
p + geom_estci(aes(size = p.value, colour = p.value), fatten = 2)
fit_log <- lm(log(Fertility) ~ 0 + Catholic + Agriculture + Examination +
Education + Infant.Mortality, data = swiss)
fit_log <- tidy(fit_log, conf.int = TRUE)
fit_log <- transform(fit_log, model = "log",
p.value = discrete_pvalue(fit_log$p.value))
two_fits <- rbind(fit, fit_log)
p <- ggplot(two_fits, aes(x = estimate, y = term, xmin = conf.low, xmax = conf.high))
# It might be possible to show groups with 'dodging', but it is currently in development.
# p + geom_estci(aes(group = model, colour = model), position = position_dodge(width = 0.3))
p + geom_estci()
p <- ggplot(two_fits, aes(x = estimate, y = term, xmin = conf.low, xmax = conf.high))
p + geom_estci() + facet_grid(~ model)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.