plot.RRlog {RRreg} | R Documentation |
Plot Logistic RR Regression
Description
Plot predicted logit values/probabilities of a randomized response logistic regression model.
Usage
## S3 method for class 'RRlog'
plot(
x,
predictor = NULL,
type = c("link", "response", "attribute"),
center.preds = TRUE,
plot.mean = TRUE,
ci = 0.95,
xlim = NULL,
steps = 50,
...
)
Arguments
x |
a fitted RRlog object |
predictor |
character name of a predictor of the model to be fitted |
type |
|
center.preds |
whether to compute predictions by assuming that all other
predictors are at their respective mean values (if |
plot.mean |
whether to plot the mean of the predictor as a vertical line |
ci |
level for confidence intervals. Use |
xlim |
if provided, these boundaries are used for the predictor on the x-axis |
steps |
number of steps for plotting |
... |
other arguments passed to the function plot (e.g., |
See Also
Examples
# generate data
n <- 500
x <- data.frame(x1 = rnorm(n))
pi.true <- 1 / (1 + exp(.3 + 1.5 * x$x1))
true <- rbinom(n, 1, plogis(pi.true))
dat <- RRgen(n, trueState = true, model = "Warner", p = .1)
x$response <- dat$response
# fit and plot RR logistic regression
mod <- RRlog(response ~ x1, data = x, model = "Warner", p = .1)
plot(mod, "x1", ci = .95, type = "attribute", ylim = 0:1)