## 95%/95% 2-sided nonlinear 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)
formula <- as.formula(y ~ b1 + (0.49 - b1)*exp(-b2*(x - 8)))
out1 <- nlregtol.int(formula = formula,
xy.data = data.frame(cbind(y, x)),
x.new=c(10,20), side = 2,
alpha = 0.05, P = 0.95 , new = TRUE)
out1
#########
set.seed(100)
x1 <- runif(50, 5, 45)
x2 <- rnorm(50, 0, 10)
f1 <- function(x1, x2, b1, b2) {(0.49 - b1)*exp(-b2*(x1 + x2 - 8)) +
rnorm(50, sd = 0.01)}
y <- f1(x1 , x2 , 0.25 , 0.39)
formula <- as.formula(y ~ (0.49 - b1)*exp(-b2*(x1 + x2 - 8)))
out2 <- nlregtol.int(formula = formula,
xy.data = data.frame(cbind(y, x1 , x2)),
x.new=cbind(c(10,20) , c(47 , 53)), side = 2,
alpha = 0.05, P = 0.95 , new = TRUE)
out2
Run the code above in your browser using DataLab