nlsint: Confidence and prediction intervals for the (expected)...

View source: R/nlsint.R

nlsintR Documentation

Confidence and prediction intervals for the (expected) response of a nonlinear regression model (experimental).

Description

This function computes approximate confidence intervals for the expected response as well as prediction intervals for a nonlinear regression model. It is designed to behave similarly to the predict function.

Usage

nlsint(
  object,
  newdata = eval(object$call$data),
  interval = c("confidence", "prediction"),
  fcov = vcov,
  level = 0.95,
  residuals = FALSE,
  ...
)

Arguments

object

Model object of class nls.

newdata

An optional data frame in which to look for variables with which to predict. If omitted the data frame used in creating the model object is used.

interval

Type of interval calculation (confidence or prediction).

fcov

Function for estimating the variance-covariance matrix of the model parameters.

level

Confidence level in (0,1).

residuals

Logical to compute leverage values and standardized residuals.

...

Arguments to pass to fcov.

Details

Standard errors for confidence intervals are estimated using the delta method. Derivatives are computed numerically rather than analytically to permit a wider range of models. Prediction intervals assume normally-distributed responses with variance inversely proportional to any specified weights, or homoscedastic error if no weights are specified. The approximate leverage ("hat") values are computed using the jacobian matrix and the approximate standardized residuals are equivalent to the "internally" standardized residuals in a linear model (i.e., as would be returned by rstandard in a linear model or rstandard with type = "pearson" in a GLM).

Examples

myreg <- nls(rate ~ (t1 + t3 * (state == "treated")) * conc /
 (t2 + t4 * (state == "treated") + conc), data = Puromycin,
 start = c(t1 = 150, t2 = 0, t3 = 0.05, t4 = 0)) 
nlsint(myreg, interval = "confidence")

trobinj/trtools documentation built on Jan. 3, 2025, 4:14 a.m.