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

View source: R/05_sdl_methods.R

residuals.sdlrmR Documentation

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 class 'sdlrm'
residuals(object, type = c("quantile", "pearson", "response"), ...)

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.

Value

A vector with the required residuals.

Examples

## 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)

sdlrm documentation built on April 12, 2025, 1:15 a.m.