Learn R Programming

sdlrm (version 0.1.2)

residuals.sdlrm: Extract Model Residuals for a Modified Skew Discrete Laplace Regression Fit

Description

Residuals resulting from fitting a modified Laplace discrete skew regression.

Usage

# S3 method for sdlrm
residuals(object, type = c("quantile", "pearson", "response"), ...)

Value

A vector with the required residuals.

Arguments

object

an object of class "sdlrm", a result of a call to sdlrm.

type

character; specifies which residual should be extracted. The available arguments are "quantile" (randomized quantile residuals; default), "pearson" (Pearson residuals, i.e., (y - mean) / sd), and "response" (raw residuals, i.e., y - mean).

...

further arguments passed to or from other methods.

Examples

Run this code
## Data set: pss (for description run ?pss)
barplot(table(pss$difference), xlab = "PSS index difference", ylab = "Frequency")
boxplot(pss$difference ~ pss$group, xlab = "Group", ylab = "PSS index difference")

## Fit with a model only for the mean (mode = 1)
fit <- sdlrm(difference ~ group, data = pss, xi = 1)

## Randomized quantile residuals
rq <- residuals(fit)

## Pearson residuals
rp <- residuals(fit, type = "pearson")

## Raw response residuals
rr <- residuals(fit, type = "response")

cbind(quantile = rq, pearson = rp, raw = rr)

Run the code above in your browser using DataLab