Learn R Programming

tolerance (version 0.4.0)

regtol.int: (Multiple) Linear Regression Tolerance Bounds

Description

Provides 1-sided or 2-sided (multiple) linear regression tolerance bounds. It is also possible to fit a regression through the origin model.

Usage

regtol.int(reg, new.x = NULL, side = 1, alpha = 0.05, P = 0.99)

Arguments

reg
An object of class lm (i.e., the results from a linear regression routine).
new.x
Any new levels of the predictor(s) for which to report the tolerance bounds. The number of columns must equal the number of predictors appearing on the right-hand side of the model in reg.
side
Whether a 1-sided or 2-sided tolerance bound is required (determined by side = 1 or side = 2, respectively).
alpha
The level chosen such that 1-alpha is the confidence level.
P
The proportion of the population to be covered by the tolerance bound(s).

Value

  • regtol.int returns a data frame with items:
  • alphaThe specified significance level.
  • PThe proportion of the population covered by the tolerance bound(s).
  • yThe value of the response given on the left-hand side of the model in reg.
  • y.hatThe predicted value of the response for the fitted linear regression model. This data frame is sorted by this value.
  • 1-sided.lowerThe 1-sided lower tolerance bound. This is given only if side = 1.
  • 1-sided.upperThe 1-sided upper tolerance bound. This is given only if side = 1.
  • 2-sided.lowerThe 2-sided lower tolerance bound. This is given only if side = 2.
  • 2-sided.upperThe 2-sided upper tolerance bound. This is given only if side = 2.

References

Wallis, W. A. (1951), Tolerance Intervals for Linear Regression, in Second Berkeley Symposium on Mathematical Statistics and Probability, ed. J. Neyman, Berkeley: University of CA Press, 43--51.

See Also

lm

Examples

Run this code
## 95\%/95\% 2-sided linear regression tolerance bounds
## for a sample of size 100. 

set.seed(100)
x <- runif(100, 0, 10)
y <- 20 + 5*x + rnorm(100, 0, 3)
out <- regtol.int(reg = lm(y ~ x), new.x = cbind(c(3, 6, 9)), 
                  side = 2, alpha = 0.05, P = 0.95)
out

plottol(out, x = cbind(1, x), y = y, side = "two", x.lab = "X", 
        y.lab = "Y")

Run the code above in your browser using DataLab