nonparregtolint: Nonparametric Regression Tolerance Bounds

npregtol.intR Documentation

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

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. However, since only one tolerance bound can actually be reported for this procedure, only the first tolerance bound will be returned. Note that this is not an issue when method = "WILKS" is used as it only produces one set of tolerance bounds.

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.

new

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

Value

npregtol.int returns a data frame with items:

alpha

The specified significance level.

P

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

x

The values of the predictor variable.

y

The values of the response variable.

y.hat

The predicted value of the response for the fitted nonparametric smoothing routine.

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

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

See Also

loess, nptol.int, spline

Examples

 
## 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",
                    new = TRUE)
out

library(plotly)
plotly_regtol(tol.out = out , x = x , y = y)

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