| plot.rdhte | R Documentation |
For an rdhte object fit with a categorical covs.hte,
draw one point per group at the conventional point estimate
(Estimate) with the robust bias-corrected confidence interval
(ci.rb). A dashed horizontal line at zero gives a visual
reference for the null effect.
## S3 method for class 'rdhte'
plot(x, sort = FALSE, point.size = 2.5,
errorbar.width = 0.2, zero.line = TRUE,
title = NULL, xlab = NULL, ylab = NULL, ...)
x |
An object of class |
sort |
Logical or character; if |
point.size |
Numeric; size of the point markers. Default 2.5. |
errorbar.width |
Numeric; width of the error-bar caps relative to the x-axis discrete unit. Default 0.2. |
zero.line |
Logical; if |
title, xlab, ylab |
Optional plot annotations. Defaults derived
from the rdhte object ( |
... |
Currently unused. |
Continuous covs.hte (or no covs.hte) is not yet
supported – the function errors with a clear message in those cases.
Requires the ggplot2 package. The intervals shown are the same
robust bias-corrected CIs reported by print(x) and
summary(x): they are centered on Estimate.bc (not
Estimate) and use the robust standard error se.rb.
Because the point and the CI center can differ slightly, the point
may sit just inside or just outside the bar; this is the rdrobust
convention and is not a plotting bug.
Invisibly, a ggplot object.
## Not run:
set.seed(1)
n <- 600
x <- runif(n, -1, 1)
W <- factor(sample(c("A", "B", "C"), n, replace = TRUE))
y <- 0.5 + (x >= 0) * (W == "A") * 1.0 +
(x >= 0) * (W == "B") * 2.0 +
(x >= 0) * (W == "C") * 0.3 + rnorm(n)
m <- rdhte(y = y, x = x, covs.hte = W)
plot(m)
plot(m, sort = TRUE) # reorder by effect size
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.