Learn R Programming

sure (version 0.1.2)

autoplot.resid: Residual Plots for Cumulative Link and General Regression Models

Description

Residual-based diagnostic plots for cumulative link and general regression models using ggplot2 graphics.

Usage

autoplot.resid(object, what = c("qq", "fitted", "covariate"), x = NULL,
  fit = NULL, distribution = qnorm, alpha = 1, xlab = NULL,
  color = "#444444", shape = 19, size = 2, qqpoint.color = "#444444",
  qqpoint.shape = 19, qqpoint.size = 2, qqline.color = "#888888",
  qqline.linetype = "dashed", qqline.size = 1, smooth = TRUE,
  smooth.color = "red", smooth.linetype = 1, smooth.size = 1,
  fill = NULL, ...)

autoplot.clm(object, what = c("qq", "fitted", "covariate"), x = NULL, nsim = 1, alpha = 1, xlab = NULL, color = "#444444", shape = 19, size = 2, qqpoint.color = "#444444", qqpoint.shape = 19, qqpoint.size = 2, qqline.color = "#888888", qqline.linetype = "dashed", qqline.size = 1, smooth = TRUE, smooth.color = "red", smooth.linetype = 1, smooth.size = 1, fill = NULL, ...)

autoplot.glm(object, what = c("qq", "fitted", "covariate"), x = NULL, jitter.scale = c("probability", "response"), nsim = 1, alpha = 1, xlab = NULL, color = "#444444", shape = 19, size = 2, qqpoint.color = "#444444", qqpoint.shape = 19, qqpoint.size = 2, qqline.color = "#888888", qqline.linetype = "dashed", qqline.size = 1, smooth = TRUE, smooth.color = "red", smooth.linetype = 1, smooth.size = 1, fill = NULL, ...)

autoplot.lrm(object, what = c("qq", "fitted", "covariate"), x = NULL, nsim = 1, alpha = 1, xlab = NULL, color = "#444444", shape = 19, size = 2, qqpoint.color = "#444444", qqpoint.shape = 19, qqpoint.size = 2, qqline.color = "#888888", qqline.linetype = "dashed", qqline.size = 1, smooth = TRUE, smooth.color = "red", smooth.linetype = 1, smooth.size = 1, fill = NULL, ...)

autoplot.orm(object, what = c("qq", "fitted", "covariate"), x = NULL, nsim = 1, alpha = 1, xlab = NULL, color = "#444444", shape = 19, size = 2, qqpoint.color = "#444444", qqpoint.shape = 19, qqpoint.size = 2, qqline.color = "#888888", qqline.linetype = "dashed", qqline.size = 1, smooth = TRUE, smooth.color = "red", smooth.linetype = 1, smooth.size = 1, fill = NULL, ...)

autoplot.polr(object, what = c("qq", "fitted", "covariate"), x = NULL, nsim = 1, alpha = 1, xlab = NULL, color = "#444444", shape = 19, size = 2, qqpoint.color = "#444444", qqpoint.shape = 19, qqpoint.size = 2, qqline.color = "#888888", qqline.linetype = "dashed", qqline.size = 1, smooth = TRUE, smooth.color = "red", smooth.linetype = 1, smooth.size = 1, fill = NULL, ...)

autoplot.vglm(object, what = c("qq", "fitted", "covariate"), x = NULL, nsim = 1, alpha = 1, xlab = NULL, color = "#444444", shape = 19, size = 2, qqpoint.color = "#444444", qqpoint.shape = 19, qqpoint.size = 2, qqline.color = "#888888", qqline.linetype = "dashed", qqline.size = 1, smooth = TRUE, smooth.color = "red", smooth.linetype = 1, smooth.size = 1, fill = NULL, ...)

Arguments

object

An object of class clm, glm, lrm, orm, polr, or vglm.

what

Character string specifying what to plot. Default is "qq" which produces a quantile-quantile plots of the residuals.

x

A vector giving the covariate values to use for residual-by- covariate plots (i.e., when what = "covariate").

fit

The fitted model from which the residuals were extracted. (Only required if what = "fitted" and object inherits from class "resid".)

distribution

Function that computes the quantiles for the reference distribution to use in the quantile-quantile plot. Default is qnorm which is only appropriate for models using a probit link function. When jitter.scale = "probability", the reference distribution is always U(-0.5, 0.5). (Only required if object inherits from class "resid".)

alpha

A single values in the interval [0, 1] controlling the opacity alpha of the plotted points. Only used when nsim > 1.

xlab

Character string giving the text to use for the x-axis label in residual-by-covariate plots. Default is NULL.

color

Character string or integer specifying what color to use for the points in the residual vs fitted value/covariate plot. Default is "black".

shape

Integer or single character specifying a symbol to be used for plotting the points in the residual vs fitted value/covariate plot.

size

Numeric value specifying the size to use for the points in the residual vs fitted value/covariate plot.

qqpoint.color

Character string or integer specifying what color to use for the points in the quantile-quantile plot.

qqpoint.shape

Integer or single character specifying a symbol to be used for plotting the points in the quantile-quantile plot.

qqpoint.size

Numeric value specifying the size to use for the points in the quantile-quantile plot.

qqline.color

Character string or integer specifying what color to use for the points in the quantile-quantile plot.

qqline.linetype

Integer or character string (e.g., "dashed") specifying the type of line to use in the quantile-quantile plot.

qqline.size

Numeric value specifying the thickness of the line in the quantile-quantile plot.

smooth

Logical indicating whether or not too add a nonparametric smooth to certain plots. Default is TRUE.

smooth.color

Character string or integer specifying what color to use for the nonparametric smooth.

smooth.linetype

Integer or character string (e.g., "dashed") specifying the type of line to use for the nonparametric smooth.

smooth.size

Numeric value specifying the thickness of the line for the nonparametric smooth.

fill

Character string or integer specifying the color to use to fill the boxplots for residual-by-covariate plots when x is of class "factor". Default is NULL which colors the boxplots according to the factor levels.

...

Additional optional arguments. (Currently ignored.)

nsim

Integer specifying the number of bootstrap replicates to use.

jitter.scale

Character string specifying the scale on which to perform the jittering. Should be one of "probability" or "response". Currently only used when object inherits from class "glm". Default is "probability".

Value

A "ggplot" object.

Examples

Run this code
# NOT RUN {
# See ?resids for an example
?resids
# }

Run the code above in your browser using DataLab