Learn R Programming

tolerance (version 0.4.0)

npregtol.int: Nonparametric Regression Tolerance Bounds

Description

Provides 1-sided or 2-sided nonparametric regression tolerance bounds.

Usage

npregtol.int(x, y, y.hat, side = 1, alpha = 0.05, P = 0.99,
             method = c("WILKS", "WALD", "HM"), upper = NULL, 
             lower = NULL)

Arguments

x
A vector of values for the predictor variable. Currently, this function is only capable of handling a single predictor.
y
A vector of values for the response variable.
y.hat
A vector of fitted values extracted from a nonparametric smoothing routine.
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).
method
The method for determining which indices of the ordered residuals will be used for the tolerance bounds. "WILKS", "WALD", and "HM" are each described in nptol.int
upper
The upper bound of the data. When NULL, then the maximum of x is used.
lower
The lower bound of the data. When NULL, then the minimum of x is used.

Value

  • npregtol.int returns a data frame with items:
  • alphaThe specified significance level.
  • PThe proportion of the population covered by the tolerance bound(s).
  • xThe values of the predictor variable.
  • yThe values of the response variable.
  • y.hatThe predicted value of the response for the fitted nonparametric smoothing routine.
  • 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

Young, D. S. (2010), tolerance: An R Package for Estimating Tolerance Intervals, Journal of Statistical Software, 36(5), 1--39.

See Also

loess, nptol.int, spline

Examples

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

set.seed(100)
x <- runif(50, 5, 45)
f1 <- function(x, b1, b2) b1 + (0.49 - b1)*exp(-b2*(x - 8)) +
               rnorm(50, sd = 0.01) 
y <- f1(x, 0.39, 0.11)
y.hat <- loess(y~x)$fit
out <- npregtol.int(x = x, y = y, y.hat = y.hat, side = 2, 
                    alpha = 0.05, P = 0.95, method = "WILKS")
out

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

Run the code above in your browser using DataLab