confintd.gsl_nls: Confidence intervals for derived parameters

View source: R/nls_methods.R

confintd.gsl_nlsR Documentation

Confidence intervals for derived parameters

Description

Returns fitted values and confidence intervals for continuous functions of parameters from a fitted "gsl_nls" object.

Usage

## S3 method for class 'gsl_nls'
confintd(object, expr, level = 0.95, dtype = "symbolic", ...)

Arguments

object

A fitted model object.

expr

An expression or character vector that can be transformed to an expression giving the function(s) of the parameters to be evaluated. Each expression should evaluate to a numeric scalar.

level

A numeric scalar between 0 and 1 giving the level of the derived parameter confidence intervals.

dtype

A character string equal to "symbolic" for symbolic differentiation of expr with deriv, or "numeric" for numeric differentiation of expr with numericDeriv using forward finite differencing.

...

Additional argument(s) for methods

Details

This method assumes (approximate) normality of the errors in the model and confidence intervals are calculated using the delta method, i.e. a first-order Taylor approximation of the (continuous) function of the parameters. If dtype = "symbolic" (the default), expr is differentiated with respect to the parameters using symbolic differentiation with deriv. As such, each expression in expr must contain only operators that are known to deriv. If dtype = "numeric", expr is differentiated using numeric differentiation with numericDeriv, which should be used if expr cannot be derived symbolically with deriv.

Value

A matrix with columns giving the fitted values and lower and upper confidence limits for each derived parameter. The row names list the individual derived parameter expressions.

See Also

confint

Examples

## data
set.seed(1)
n <- 50
xy <- data.frame(
  x = (1:n) / n, 
  y = 2.5 * exp(-1.5 * (1:n) / n) + rnorm(n, sd = 0.1)
)
## model
obj <- gsl_nls(fn = y ~ A * exp(-lam * x), data = xy, start = c(A = 1, lam = 1))

## delta method ci's
confintd(obj, expr = c("log(lam)", "A / lam"))

gslnls documentation built on Jan. 17, 2023, 5:15 p.m.