regtolint: (Multiple) Linear Regression Tolerance Bounds

regtol.intR Documentation

(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, new = FALSE) 

Arguments

reg

An object of class lm (i.e., the results from a linear regression routine).

new.x

An optional data frame in which to look for variables with which to predict. If omitted, the fitted values are used.

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

new

When new = TRUE, the function shows updated version of outcomes.

Value

regtol.int returns a data frame with items:

alpha

The specified significance level.

P

The proportion of the population covered by the tolerance bound(s).

y

The value of the response given on the left-hand side of the model in reg.

y.hat

The predicted value of the response for the fitted linear regression model. This data frame is sorted by this value.

1-sided.lower

The 1-sided lower tolerance bound. This is given only if side = 1.

1-sided.upper

The 1-sided upper tolerance bound. This is given only if side = 1.

2-sided.lower

The 2-sided lower tolerance bound. This is given only if side = 2.

2-sided.upper

The 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.

Young, D. S. (2013), Regression Tolerance Intervals, Communications in Statistics - Simulation and Computation, 42, 2040–2055.

See Also

lm

Examples

 
## 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 = data.frame(x = 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")


tolerance documentation built on May 29, 2024, 7:38 a.m.