| Title: | Influence Diagnostics in Statistical Models |
|---|---|
| Description: | Set of routines for influence diagnostics by using case-deletion in ordinary least squares, nonlinear regression [Ross (1987). <doi:10.2307/3315198>], ridge estimation [Walker and Birch (1988). <doi:10.1080/00401706.1988.10488370>] and least absolute deviations (LAD) regression [Sun and Wei (2004). <doi:10.1016/j.spl.2003.08.018>]. |
| Authors: | Felipe Osorio [aut, cre] (ORCID: <https://orcid.org/0000-0002-4675-5201>) |
| Maintainer: | Felipe Osorio <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1-4 |
| Built: | 2026-05-12 09:25:05 UTC |
| Source: | https://github.com/faosorios/india |
This dataset is presented in Rousseeuw and Leroy (1987, pp. 154), and the aim is to model the cost of 23 single-engine aircraft (in unit of $100,000) as a function of the following explanatory variables: aspect ratio, lift-to-drag ratio, weight of the plane, in pounds, and maximal thrust.
data(aircraft)data(aircraft)
A data frame with 23 observations on the following 5 variables.
aspect ratio.
lift-to-drag ratio.
weight of the plane (in pounds).
maximal thrust.
cost of 23 single-engine aircraft (in unit of $100,000).
Rousseeuw, P.J., Leroy, A.M. (1987). Robust Regression and Outlier Detection. Wiley, New York.
Cook's distance is a measure to assess the influence of the ith observation on the model parameter estimates. This function computes the Cook's distance based on leave-one-out cases deletion for ordinary least squares, nonlinear least squares, lad and ridge regression.
## S3 method for class 'ols' cooks.distance(model, ...) ## S3 method for class 'nls' cooks.distance(model, ...) ## S3 method for class 'lad' cooks.distance(model, ...) ## S3 method for class 'ridge' cooks.distance(model, type = "cov", ...)## S3 method for class 'ols' cooks.distance(model, ...) ## S3 method for class 'nls' cooks.distance(model, ...) ## S3 method for class 'lad' cooks.distance(model, ...) ## S3 method for class 'ridge' cooks.distance(model, type = "cov", ...)
model |
an R object, returned by |
type |
only required for |
... |
further arguments passed to or from other methods. |
A vector whose ith element contains the Cook's distance,
for , with a positive definite matrix and . Specific
choices of and are done for objects of class ols, nls,
lad and ridge.
The Cook's distance for nonlinear regression is based on linear approximation, which may be inappropriate for expectation surfaces markedly nonplanar.
Cook, R.D., Weisberg, S. (1980). Characterizations of an empirical influence function for detecting influential cases in regression. Technometrics 22, 495-508. doi:10.1080/00401706.1980.10486199
Cook, R.D., Weisberg, S. (1982). Residuals and Influence in Regression. Chapman and Hall, London.
Ross, W.H. (1987). The geometry of case deletion and the assessment of influence in nonlinear regression. The Canadian Journal of Statistics 15, 91-103. doi:10.2307/3315198
Sun, R.B., Wei, B.C. (2004). On influence assessment for LAD regression. Statistics & Probability Letters 67, 97-110. doi:10.1016/j.spl.2003.08.018
Walker, E., Birch, J.B. (1988). Influence measures in ridge regression. Technometrics 30, 221-227. doi:10.1080/00401706.1988.10488370
# Cook's distances for linear regression fm <- ols(stack.loss ~ ., data = stackloss) CD <- cooks.distance(fm) plot(CD, ylab = "Cook's distances", ylim = c(0,0.8)) text(21, CD[21], label = as.character(21), pos = 3) # Cook's distances for LAD regression fm <- lad(stack.loss ~ ., data = stackloss) CD <- cooks.distance(fm) plot(CD, ylab = "Cook's distances", ylim = c(0,0.4)) text(17, CD[17], label = as.character(17), pos = 3) # Cook's distances for ridge regression data(portland) fm <- ridge(y ~ ., data = portland) CD <- cooks.distance(fm) plot(CD, ylab = "Cook's distances", ylim = c(0,0.5)) text(8, CD[8], label = as.character(8), pos = 3) # Cook's distances for nonlinear regression data(skeena) model <- recruits ~ b1 * spawners * exp(-b2 * spawners) fm <- nls(model, data = skeena, start = list(b1 = 3, b2 = 0)) CD <- cooks.distance(fm) plot(CD, ylab = "Cook's distances", ylim = c(0,0.35)) obs <- c(5, 6, 9, 19, 25) text(obs, CD[obs], label = as.character(obs), pos = 3)# Cook's distances for linear regression fm <- ols(stack.loss ~ ., data = stackloss) CD <- cooks.distance(fm) plot(CD, ylab = "Cook's distances", ylim = c(0,0.8)) text(21, CD[21], label = as.character(21), pos = 3) # Cook's distances for LAD regression fm <- lad(stack.loss ~ ., data = stackloss) CD <- cooks.distance(fm) plot(CD, ylab = "Cook's distances", ylim = c(0,0.4)) text(17, CD[17], label = as.character(17), pos = 3) # Cook's distances for ridge regression data(portland) fm <- ridge(y ~ ., data = portland) CD <- cooks.distance(fm) plot(CD, ylab = "Cook's distances", ylim = c(0,0.5)) text(8, CD[8], label = as.character(8), pos = 3) # Cook's distances for nonlinear regression data(skeena) model <- recruits ~ b1 * spawners * exp(-b2 * spawners) fm <- nls(model, data = skeena, start = list(b1 = 3, b2 = 0)) CD <- cooks.distance(fm) plot(CD, ylab = "Cook's distances", ylim = c(0,0.35)) obs <- c(5, 6, 9, 19, 25) text(obs, CD[obs], label = as.character(obs), pos = 3)
Constructs a normal QQ-plot with simulated envelope of residuals from a fitted model object.
envelope(object, ...) ## S3 method for class 'lm' envelope(object, reps = 50, conf = 0.95, type = c("quantile", "standard", "student"), plot.it = TRUE, ...) ## S3 method for class 'lad' envelope(object, reps = 50, conf = 0.95, plot.it = TRUE, ...) ## S3 method for class 'ols' envelope(object, reps = 50, conf = 0.95, type = c("quantile", "standard", "student"), plot.it = TRUE, ...) ## S3 method for class 'nls' envelope(object, reps = 50, conf = 0.95, plot.it = TRUE, ...) ## S3 method for class 'ridge' envelope(object, reps = 50, conf = 0.95, plot.it = TRUE, ...)envelope(object, ...) ## S3 method for class 'lm' envelope(object, reps = 50, conf = 0.95, type = c("quantile", "standard", "student"), plot.it = TRUE, ...) ## S3 method for class 'lad' envelope(object, reps = 50, conf = 0.95, plot.it = TRUE, ...) ## S3 method for class 'ols' envelope(object, reps = 50, conf = 0.95, type = c("quantile", "standard", "student"), plot.it = TRUE, ...) ## S3 method for class 'nls' envelope(object, reps = 50, conf = 0.95, plot.it = TRUE, ...) ## S3 method for class 'ridge' envelope(object, reps = 50, conf = 0.95, plot.it = TRUE, ...)
object |
|
reps |
number of simulated point patterns to be generated when computing the envelopes. The default number is 50, a larger number of replications will produce a smoother band, although it takes more time. |
conf |
the confidence level required for the construction of the envelope. The default is to find 95% confidence envelopes. |
type |
a character string indicating the type of residuals that should be used in the
construction of the envelope. The available options are randomized quantile ( |
plot.it |
if |
... |
further arguments passed to or from other methods. |
a list containing the following elements:
residuals |
a vector with the selected (see |
envelope |
a matrix with two columns corresponding to the values of the lower and upper pointwise confidence envelope. |
Atkinson, A.C. (1985). Plots, Transformations and Regression. Oxford University Press, Oxford.
Osorio, F. (2026). On the mean-shift outlier model for LAD regression. Working paper.
Venables, W.N., Ripley, B.D. (1999). Modern Applied Statistics with S-PLUS, 3rd Ed. Springer, New York.
# QQ-plot with envelope for linear regression fm <- ols(stack.loss ~ ., data = stackloss) z <- envelope(fm, reps = 500) # QQ-plot with envelope for LAD regression data(ereturns) fm <- lad(m.marietta ~ CRSP, data = ereturns) z <- envelope(fm, reps = 500) # QQ-plot with envelope for ridge regression data(portland) fm <- ridge(y ~ ., data = portland) z <- envelope(fm, reps = 500) # QQ-plot with envelope nonlinear regression data(skeena) model <- recruits ~ b1 * spawners * exp(-b2 * spawners) fm <- nls(model, data = skeena, start = list(b1 = 3, b2 = 0)) z <- envelope(fm, reps = 500)# QQ-plot with envelope for linear regression fm <- ols(stack.loss ~ ., data = stackloss) z <- envelope(fm, reps = 500) # QQ-plot with envelope for LAD regression data(ereturns) fm <- lad(m.marietta ~ CRSP, data = ereturns) z <- envelope(fm, reps = 500) # QQ-plot with envelope for ridge regression data(portland) fm <- ridge(y ~ ., data = portland) z <- envelope(fm, reps = 500) # QQ-plot with envelope nonlinear regression data(skeena) model <- recruits ~ b1 * spawners * exp(-b2 * spawners) fm <- nls(model, data = skeena, start = list(b1 = 3, b2 = 0)) z <- envelope(fm, reps = 500)
Computes leverage measures from a fitted model object.
leverages(model, ...) ## S3 method for class 'lm' leverages(model, infl = lm.influence(model, do.coef = FALSE), ...) ## S3 method for class 'nls' leverages(model, type = "tangent", ...) ## S3 method for class 'ols' leverages(model, ...) ## S3 method for class 'ridge' leverages(model, ...) ## S3 method for class 'ols' hatvalues(model, ...) ## S3 method for class 'ridge' hatvalues(model, ...)leverages(model, ...) ## S3 method for class 'lm' leverages(model, infl = lm.influence(model, do.coef = FALSE), ...) ## S3 method for class 'nls' leverages(model, type = "tangent", ...) ## S3 method for class 'ols' leverages(model, ...) ## S3 method for class 'ridge' leverages(model, ...) ## S3 method for class 'ols' hatvalues(model, ...) ## S3 method for class 'ridge' hatvalues(model, ...)
model |
|
infl |
influence structure as returned by |
type |
only required for |
... |
further arguments passed to or from other methods. |
A vector containing the diagonal of the prediction (or ‘hat’) matrix.
For linear regression (i.e., for "lm" or "ols" objects) the prediction matrix assumes
the form
in which case, for . Whereas
for ridge regression, the prediction matrix is given by
where represents the ridge parameter. Thus, the diagonal elements of ,
are , .
In nonlinear regression, the tangent plane leverage matrix is given by
where is the local model matrix with ith
row and ,
whereas the Jacobian leverage matrix adopts the form:
where is the vector of residuals,
is the three-dimensional array constructed by n Hessian matrices of order
of and denotes array multiplication as defined by Bates and Watts (1980).
This function never creates the prediction matrix and only obtains its diagonal elements using
the QR or singular value decomposition (only for ridge regression) of or .
Function hatvalues only is a wrapper for function leverages.
Warning: Starting from version 4.6.0 of R, the function hatvalues.nls() will be included
in the stats package; therefore, it has been removed from india. Please use function
leverages.nls() instead.
Bates, D.W., Watts, D.G. (1980). Relative curvature measures of nonlineary (with discussion). Journal of the Royal Statistical Society, Series B 42, 1-25. doi:10.1111/j.2517-6161.1980.tb01094.x
Chatterjee, S., Hadi, A.S. (1988). Sensivity Analysis in Linear Regression. Wiley, New York.
Cook, R.D., Weisberg, S. (1982). Residuals and Influence in Regression. Chapman and Hall, London.
Ross, W.H. (1987). The geometry of case deletion and the assessment of influence in nonlinear regression. The Canadian Journal of Statistics 15, 91-103. doi:10.2307/3315198
St. Laurent, R.T., Cook, R.D. (1992). Leverage and superleverage in nonlinear regression. Journal of the American Statistical Association 87, 985-990. doi:10.1080/01621459.1992.10476253
St. Laurent, R.T., Cook, R.D. (1993). Leverage, local influence and curvature in nonlinear regression. Biometrika 80, 99-106. doi:10.1093/biomet/80.1.99
Walker, E., Birch, J.B. (1988). Influence measures in ridge regression. Technometrics 30, 221-227. doi:10.1080/00401706.1988.10488370
# Leverages for linear regression fm <- ols(stack.loss ~ ., data = stackloss) lev <- leverages(fm) cutoff <- 2 * mean(lev) plot(lev, ylab = "Leverages", ylim = c(0,0.45)) abline(h = cutoff, lty = 2, lwd = 2, col = "red") text(17, lev[17], label = as.character(17), pos = 3) # Leverages for ridge regression data(portland) fm <- ridge(y ~ ., data = portland) lev <- leverages(fm) cutoff <- 2 * mean(lev) plot(lev, ylab = "Leverages", ylim = c(0,0.7)) abline(h = cutoff, lty = 2, lwd = 2, col = "red") text(10, lev[10], label = as.character(10), pos = 3) # Leverages for nonlinear regression data(skeena) model <- recruits ~ b1 * spawners * exp(-b2 * spawners) fm <- nls(model, data = skeena, start = list(b1 = 3, b2 = 0)) lev0 <- leverages(fm, type = "tangent") plot(lev0, ylab = "Tangent plane leverages", ylim = c(0,0.25)) obs <- c(1,9) text(obs, lev0[obs], label = as.character(obs), pos = 3) lev1 <- leverages(fm, type = "jacobian") plot(lev1, ylab = "Jacobian leverages", ylim = c(0,0.25)) obs <- c(1,9) text(obs, lev1[obs], label = as.character(obs), pos = 3) # in this example both leverages (tangent and jacobian) # are quite similar plot(lev0, lev1, xlab = "Tangent plane leverages", ylab = "Jacobian leverages") abline(c(0,1), lty = 2, lwd = 2, col = "red")# Leverages for linear regression fm <- ols(stack.loss ~ ., data = stackloss) lev <- leverages(fm) cutoff <- 2 * mean(lev) plot(lev, ylab = "Leverages", ylim = c(0,0.45)) abline(h = cutoff, lty = 2, lwd = 2, col = "red") text(17, lev[17], label = as.character(17), pos = 3) # Leverages for ridge regression data(portland) fm <- ridge(y ~ ., data = portland) lev <- leverages(fm) cutoff <- 2 * mean(lev) plot(lev, ylab = "Leverages", ylim = c(0,0.7)) abline(h = cutoff, lty = 2, lwd = 2, col = "red") text(10, lev[10], label = as.character(10), pos = 3) # Leverages for nonlinear regression data(skeena) model <- recruits ~ b1 * spawners * exp(-b2 * spawners) fm <- nls(model, data = skeena, start = list(b1 = 3, b2 = 0)) lev0 <- leverages(fm, type = "tangent") plot(lev0, ylab = "Tangent plane leverages", ylim = c(0,0.25)) obs <- c(1,9) text(obs, lev0[obs], label = as.character(obs), pos = 3) lev1 <- leverages(fm, type = "jacobian") plot(lev1, ylab = "Jacobian leverages", ylim = c(0,0.25)) obs <- c(1,9) text(obs, lev1[obs], label = as.character(obs), pos = 3) # in this example both leverages (tangent and jacobian) # are quite similar plot(lev0, lev1, xlab = "Tangent plane leverages", ylab = "Jacobian leverages") abline(c(0,1), lty = 2, lwd = 2, col = "red")
Compute the likelihood displacement influence measure based on leave-one-out cases deletion for linear models, lad and ridge regression.
logLik.displacement(model, ...) ## S3 method for class 'lm' logLik.displacement(model, pars = "full", ...) ## S3 method for class 'ols' logLik.displacement(model, pars = "full", ...) ## S3 method for class 'nls' logLik.displacement(model, ...) ## S3 method for class 'lad' logLik.displacement(model, method = "quasi", pars = "full", ...) ## S3 method for class 'ridge' logLik.displacement(model, pars = "full", ...)logLik.displacement(model, ...) ## S3 method for class 'lm' logLik.displacement(model, pars = "full", ...) ## S3 method for class 'ols' logLik.displacement(model, pars = "full", ...) ## S3 method for class 'nls' logLik.displacement(model, ...) ## S3 method for class 'lad' logLik.displacement(model, method = "quasi", pars = "full", ...) ## S3 method for class 'ridge' logLik.displacement(model, pars = "full", ...)
model |
|
pars |
should be considered the whole vector of parameters ( |
method |
only required for |
... |
further arguments passed to or from other methods. |
A vector whose ith element contains the distance between the likelihood functions,
for pars = "full", where and
denote the estimates of and when the ith observation is
removed from the dataset. If we are interested only in (i.e. pars = "coef")
the likelihood displacement becomes
Cook, R.D., Weisberg, S. (1982). Residuals and Influence in Regression. Chapman and Hall, London.
Cook, R.D., Pena, D., Weisberg, S. (1988). The likelihood displacement: A unifying principle for influence measures. Communications in Statistics - Theory and Methods 17, 623-640. doi:10.1080/03610928808829645
Elian, S.N., Andre, C.D.S., Narula, S.C. (2000). Influence measure for the L1 regression. Communications in Statistics - Theory and Methods 29, 837-849. doi:10.1080/03610920008832518
Ogueda, A., Osorio, F. (2025). Influence diagnostics for ridge regression using the Kullback-Leibler divergence. Statistical Papers 66, 85. doi:10.1007/s00362-025-01701-1
Ross, W.H. (1987). The geometry of case deletion and the assessment of influence in nonlinear regression. The Canadian Journal of Statistics 15, 91-103. doi:10.2307/3315198
Sun, R.B., Wei, B.C. (2004). On influence assessment for LAD regression. Statistics & Probability Letters 67, 97-110. doi:10.1016/j.spl.2003.08.018
# Likelihood displacement for linear regression fm <- ols(stack.loss ~ ., data = stackloss) LD <- logLik.displacement(fm) plot(LD, ylab = "Likelihood displacement", ylim = c(0,9)) text(21, LD[21], label = as.character(21), pos = 3) # Likelihood displacement for LAD regression fm <- lad(stack.loss ~ ., data = stackloss) LD <- logLik.displacement(fm) plot(LD, ylab = "Likelihood displacement", ylim = c(0,1.5)) text(17, LD[17], label = as.character(17), pos = 3) # Likelihood displacement for ridge regression data(portland) fm <- ridge(y ~ ., data = portland) LD <- logLik.displacement(fm) plot(LD, ylab = "Likelihood displacement", ylim = c(0,4)) text(8, LD[8], label = as.character(8), pos = 3) # Likelihood displacement for nonlinear regression data(skeena) model <- recruits ~ b1 * spawners * exp(-b2 * spawners) fm <- nls(model, data = skeena, start = list(b1 = 3, b2 = 0)) LD <- logLik.displacement(fm) plot(LD, ylab = "Likelihood displacement", ylim = c(0,0.7)) obs <- c(5, 6, 9, 19, 25) text(obs, LD[obs], label = as.character(obs), pos = 3)# Likelihood displacement for linear regression fm <- ols(stack.loss ~ ., data = stackloss) LD <- logLik.displacement(fm) plot(LD, ylab = "Likelihood displacement", ylim = c(0,9)) text(21, LD[21], label = as.character(21), pos = 3) # Likelihood displacement for LAD regression fm <- lad(stack.loss ~ ., data = stackloss) LD <- logLik.displacement(fm) plot(LD, ylab = "Likelihood displacement", ylim = c(0,1.5)) text(17, LD[17], label = as.character(17), pos = 3) # Likelihood displacement for ridge regression data(portland) fm <- ridge(y ~ ., data = portland) LD <- logLik.displacement(fm) plot(LD, ylab = "Likelihood displacement", ylim = c(0,4)) text(8, LD[8], label = as.character(8), pos = 3) # Likelihood displacement for nonlinear regression data(skeena) model <- recruits ~ b1 * spawners * exp(-b2 * spawners) fm <- nls(model, data = skeena, start = list(b1 = 3, b2 = 0)) LD <- logLik.displacement(fm) plot(LD, ylab = "Likelihood displacement", ylim = c(0,0.7)) obs <- c(5, 6, 9, 19, 25) text(obs, LD[obs], label = as.character(obs), pos = 3)
This dataset comes from an experimental investigation of the heat evolved during the setting and hardening of Portland cements of varied composition and the dependence of this heat on the percentages of four compounds in the clinkers from which the cement was produced.
data(portland)data(portland)
A data frame with 13 observations on the following 5 variables.
The heat evolved after 180 days of curing, measured in calories per gram of cement.
Tricalcium aluminate.
Tricalcium silicate.
Tetracalcium aluminoferrite.
-dicalcium silicate.
Kaciranlar, S., Sakallioglu, S., Akdeniz, F., Styan, G.P.H., Werner, H.J. (1999). A new biased estimator in linear regression and a detailed analysis of the widely-analysed dataset on Portland cement. Sankhya, Series B 61, 443-459.
Compute the relative condition index to identify collinearity-influential points in linear models.
relative.condition(x)relative.condition(x)
x |
the model matrix |
To assess the influence of the ith row of on the condition index of ,
Hadi (1988) proposed the relative change,
for , where and
denote the (scaled) condition index for and , respectively.
Chatterjee, S., Hadi, A.S. (1988). Sensivity Analysis in Linear Regression. Wiley, New York.
Hadi, A.S. (1988). Diagnosing collinerity-influential observations. Computational Statistics & Data Analysis 7, 143-159. doi:10.1016/0167-9473(88)90089-8.
data(portland) fm <- ridge(y ~ ., data = portland, x = TRUE) x <- fm$x rel <- relative.condition(x) plot(rel, ylab = "Relative condition number", ylim = c(-0.1,0.4)) abline(h = 0, lty = 2, lwd = 2, col = "red") text(3, rel[3], label = as.character(3), pos = 3)data(portland) fm <- ridge(y ~ ., data = portland, x = TRUE) x <- fm$x rel <- relative.condition(x) plot(rel, ylab = "Relative condition number", ylim = c(-0.1,0.4)) abline(h = 0, lty = 2, lwd = 2, col = "red") text(3, rel[3], label = as.character(3), pos = 3)
Compute randomized quantile residuals from a fitted model object.
rquantile(model, ...) ## S3 method for class 'lm' rquantile(model, ...) ## S3 method for class 'lad' rquantile(model, ...) ## S3 method for class 'ols' rquantile(model, ...) ## S3 method for class 'nls' rquantile(model, ...) ## S3 method for class 'ridge' rquantile(model, ...)rquantile(model, ...) ## S3 method for class 'lm' rquantile(model, ...) ## S3 method for class 'lad' rquantile(model, ...) ## S3 method for class 'ols' rquantile(model, ...) ## S3 method for class 'nls' rquantile(model, ...) ## S3 method for class 'ridge' rquantile(model, ...)
model |
|
... |
further arguments passed to or from other methods. |
a vector containing standard normal deviates representing standardized residuals. This kind of residuals are exactly normal.
Dunn, P.K., Smyth, G.K. (1996). Randomized quantile residuals. Journal of Computational and Graphical Statistics 5, 236-244. doi:10.1080/10618600.1996.10474708
Osorio, F. (2026). On the mean-shift outlier model for LAD regression. Working paper.
# quantile residuals for linear regression fm <- ols(stack.loss ~ ., data = stackloss) res <- rquantile(fm) plot(res, ylim = c(-3,3), ylab = "quantile residuals") abline(h = 0, lwd = 2, col = "gray75") abline(h = c(-2,2), lwd = 2, lty = 2, col = "red") text(21, res[21], as.character(21), pos = 1) # quantile residuals for LAD regression data(ereturns) fm <- lad(m.marietta ~ CRSP, data = ereturns) res <- rquantile(fm) plot(res, ylim = c(-2,4.5), ylab = "quantile residuals") abline(h = 0, lwd = 2, col = "gray75") abline(h = c(-2,2), lwd = 2, lty = 2, col = "red") obs <- c(8,15,34) text(obs, res[obs], as.character(obs), pos = 3) # quantile residuals for ridge regression data(portland) fm <- ridge(y ~ ., data = portland) res <- rquantile(fm) plot(res, ylim = c(-2,2), ylab = "quantile residuals") abline(h = 0, lwd = 2, col = "gray75") # quantile residuals for nonlinear regression data(skeena) model <- recruits ~ b1 * spawners * exp(-b2 * spawners) fm <- nls(model, data = skeena, start = list(b1 = 3, b2 = 0)) res <- rquantile(fm) plot(res, ylim = c(-3,3), ylab = "quantile residuals") abline(h = 0, lwd = 2, col = "gray75") abline(h = c(-2,2), lwd = 2, lty = 2, col = "red") text(5, res[5], as.character(5), pos = 3)# quantile residuals for linear regression fm <- ols(stack.loss ~ ., data = stackloss) res <- rquantile(fm) plot(res, ylim = c(-3,3), ylab = "quantile residuals") abline(h = 0, lwd = 2, col = "gray75") abline(h = c(-2,2), lwd = 2, lty = 2, col = "red") text(21, res[21], as.character(21), pos = 1) # quantile residuals for LAD regression data(ereturns) fm <- lad(m.marietta ~ CRSP, data = ereturns) res <- rquantile(fm) plot(res, ylim = c(-2,4.5), ylab = "quantile residuals") abline(h = 0, lwd = 2, col = "gray75") abline(h = c(-2,2), lwd = 2, lty = 2, col = "red") obs <- c(8,15,34) text(obs, res[obs], as.character(obs), pos = 3) # quantile residuals for ridge regression data(portland) fm <- ridge(y ~ ., data = portland) res <- rquantile(fm) plot(res, ylim = c(-2,2), ylab = "quantile residuals") abline(h = 0, lwd = 2, col = "gray75") # quantile residuals for nonlinear regression data(skeena) model <- recruits ~ b1 * spawners * exp(-b2 * spawners) fm <- nls(model, data = skeena, start = list(b1 = 3, b2 = 0)) res <- rquantile(fm) plot(res, ylim = c(-3,3), ylab = "quantile residuals") abline(h = 0, lwd = 2, col = "gray75") abline(h = c(-2,2), lwd = 2, lty = 2, col = "red") text(5, res[5], as.character(5), pos = 3)
The data have 28 observations of spawners and recruits (units are thousands of fish) from 1940 until 1967 for the Skeena river sockeye salmon stock.
data(skeena)data(skeena)
A data frame with 28 observations on the following 3 variables.
Years in which the number of spawners and recruits were recorded.
Size of the annual spawning stock.
Production of new catchable-sized fish.
Carroll, R.J., Ruppert, D. (1988). Transformation and Weighting in Regression. Chapman and Hall, London.