ci_plot | R Documentation |
"Forest plot"-style plotting of confidence intervals from a regression model. Basic input is a matrix with columns of estimate/lower/upper, along with an optional 4th column for the p-value. Also works with a variety of models (lm/glm/coxph/etc).
ci_plot(obj, ...)
## S3 method for class 'matrix'
ci_plot(
obj,
sort = TRUE,
diff = (ncol(obj) == 4),
null = 0,
trans,
p_label = FALSE,
...
)
## S3 method for class 'lm'
ci_plot(obj, intercept = FALSE, exclude = NULL, plot = TRUE, tau, ...)
## S3 method for class 'glm'
ci_plot(obj, ...)
## S3 method for class 'mer'
ci_plot(
obj,
intercept = FALSE,
exclude = NULL,
plot = TRUE,
tau,
nsim = 500,
...
)
## S3 method for class 'coxph'
ci_plot(obj, exclude = NULL, plot = TRUE, tau, ...)
## S3 method for class 'data.frame'
ci_plot(obj, ...)
obj |
The object to be plotted; can be a matrix of raw values or a model object |
... |
Not used |
sort |
Sort parameters by estimate? (default: true) |
diff |
Include tests of difference / p-values? |
null |
Draw a line representing no effect at this value (default: 0) |
trans |
Transformation to be applied (e.g., |
p_label |
Label p-values (p=0.02 instead of just 0.02)? (default: FALSE) |
intercept |
Include a CI for the intercept? (default: FALSE) |
exclude |
Variables to exclude (character vector) |
plot |
If FALSE, just returns the matrix of estimates/CIs/p-values to be plotted but doesn't plot anything |
tau |
A named vector of effect sizes; CIs will be shown for tau*beta. Any coefficients not included are given tau = 1. |
nsim |
Number of simulations; see |
TO-DO:
interactions
ci_int()
# Supplying a matrix
B <- cbind(1:9, 0:8, 2:10)
rownames(B) <- LETTERS[1:9]
ci_plot(B)
# Supplying a fitted model object
fit <- lm(Ozone ~ Solar.R + Wind + Temp, airquality)
ci_plot(fit)
ci_plot(fit, tau=c(Solar.R = 100, Temp = 10, Wind = 3))
ci_plot(fit, tau=c(Solar.R = 100))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.