Learn R Programming

visStatistics (version 0.3.0)

qq_lm_envelope: Simulated Q-Q envelopes for linear model residuals

Description

Computes pointwise and simultaneous Q-Q envelopes for internally studentised residuals from an unweighted lm or aov object by repeatedly simulating responses from the fitted normal-error model and refitting the model. The simultaneous envelope follows the Monte Carlo tolerance-band idea of Schuetzenmeister et al. (2012, doi:10.1080/03610918.2011.582560).

Usage

qq_lm_envelope(
  model,
  conf.level = 0.95,
  nsim = getOption("visStatistics.qq_nsim", 5000L),
  q.type = 2L,
  tol = 1e-04,
  max.iter = 100L
)

Value

A list of class qq_lm_envelope with the observed sorted residuals, theoretical quantiles, pointwise bounds, simultaneous bounds, the simulated sorted residual matrix, and the achieved simultaneous coverage.

Arguments

model

An unweighted lm or aov object.

conf.level

Numeric confidence level for the envelopes.

nsim

Integer number of simulated refits.

q.type

Integer quantile type passed to stats::quantile().

tol

Numeric tolerance for the simultaneous-band coverage search.

max.iter

Integer maximum number of bisection iterations.

Examples

Run this code
fit <- lm(mpg ~ wt, data = mtcars)
env <- qq_lm_envelope(fit, nsim = 100)
str(env)

Run the code above in your browser using DataLab