envelope: Envelope Plot for the Residuals of a Modified Skew Discrete...

View source: R/07_sdl_diagnostic.R

envelopeR Documentation

Envelope Plot for the Residuals of a Modified Skew Discrete Laplace Regression Fit

Description

Provides the normal probability plot with simulated envelope of Pearson residuals and randomized quantile residuals resulting from the modified skew discrete Laplace (SDL) regression fit.

Usage

envelope(object, nsim = 99, progressBar = TRUE, plot = TRUE, ...)

## S3 method for class 'envelope'
print(x, ...)

## S3 method for class 'envelope'
plot(x, type = c("quantile", "pearson"), level = 0.95, ...)

Arguments

object, x

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

nsim

the number of replicates. The default is nsim = 99.

progressBar

logical; if TRUE, a progress bar is displayed giving the progress of making the graph. It can slow down the function considerably in applications with a large sample size.

plot

logical; if TRUE, the envelope plot of the residuals is displayed.

...

further arguments passed to or from other methods.

type

character; specifies which residual should be produced in the envelope plot. The available options are "quantile" (default) and "pearson" ((y - mean) / sd).

level

level of the sample quantile of the residual used in the construction of confidence bands.

Value

envelope returns an "sdlrm_envel" object which consists of a list with the following components:

residuals

a list with the quantile and pearson residuals resulting from the fit of the SDL regression model.

simulation

a list whose components are matrices containing the ordered quantile and pearson residuals of the simulation for the plot envelope.

The method plot makes the envelope plot.

Author(s)

Rodrigo M. R. de Medeiros <rodrigo.matheus@ufrn.br>

References

Medeiros, R. M. R., and Bourguignon, M. (2025). Modified skew discrete Laplace regression models for integer valued data with applications to paired samples. Manuscript submitted for publication.

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)

## Building the envelope plot
envel <- envelope(fit, plot = FALSE)

# Class
class(envel)
envel

# Plot for the randomized quantile residuals (default)
plot(envel)

# Plot for the Pearson residuals
plot(envel, type = "pearson")

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