plot.RRlog: Plot Logistic RR Regression

Description Usage Arguments See Also Examples

Description

Plot predicted logit values/probabilities of a randomized response logistic regression model.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## 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

"response" returns predicted probabilities for the (observable) RR responses, "link" returns predicted logit-values for the (latent) sensitive attribute, and "attribute" returns predicted probabilities of having the (latent) sensitive attribute.

center.preds

whether to compute predictions by assuming that all other predictors are at their respective mean values (if FALSE: all other predictors are set to zero)

plot.mean

whether to plot the mean of the predictor as a vertical line

ci

level for confidence intervals. Use ci=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 (e.g., ylim=c(0,1)).

See Also

predict.RRlog

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
 # 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)
 

danheck/RRreg documentation built on Sept. 5, 2021, 7:36 p.m.