Learn R Programming

RRreg (version 0.4.1)

plot.RRlog: Plot Logistic RR Regression

Description

Plot the predictions of a fitted logistic RR regression model. Data are not included directly, as these are not directly interpretable due to the RR design.

Usage

## S3 method for class 'RRlog':
plot(x, predictor = NULL, center.preds = T, plot.mean = T,
  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
center.preds
whether to compute predictions by assuming that all other predictors are at their respective mean values (if FALSE: all other predictors set to zero)
plot.mean
whether to plot mean of predictor as vertical line
ci
level for confidence intervals. Set to 0 to omit.
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

Examples

Run this code
# generate data
 n <- 500
 x <- data.frame(x1=rnorm(n))
 pi.true <- 1/(1+exp(.3+1.5*x$x1))
 dat <- RRgen(n, pi.true=pi.true, model="Warner", p=.1)
 x$response <- dat$response
 # fit and plot model
 mod <- RRlog(response ~ x1, data=x, model="Warner", p=.1)
 plot(mod, "x1" ,ci=.95)

Run the code above in your browser using DataLab