| confintd.gsl_nls {gslnls} | R 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 |
level |
A numeric scalar between 0 and 1 giving the level of the derived parameter confidence intervals. |
dtype |
A character string equal to |
... |
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
Examples
## data
set.seed(1)
n <- 25
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"))