confint.gsl_nls: Confidence interval for model parameters

View source: R/nls_methods.R

confint.gsl_nlsR Documentation

Confidence interval for model parameters

Description

Returns asymptotic or profile likelihood confidence intervals for the parameters in a fitted "gsl_nls" object.

Usage

## S3 method for class 'gsl_nls'
confint(object, parm, level = 0.95, method = c("asymptotic", "profile"), ...)

Arguments

object

An object inheriting from class "gsl_nls".

parm

A character vector of parameter names for which to evaluate confidence intervals, defaults to all parameters.

level

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

method

Method to be used, either "asymptotic" for asymptotic confidence intervals or "profile" for profile likelihood confidence intervals. The latter is only available for "gsl_nls" objects that are also of class "nls".

...

At present no optional arguments are used.

Details

Method "asymptotic" assumes (approximate) normality of the errors in the model and calculates standard asymptotic confidence intervals based on the quantiles of a t-distribution. Method "profile" calculates profile likelihood confidence intervals using the confint.nls method in the MASS package and for this reason is only available for "gsl_nls" objects that are also of class "nls".

Value

A matrix with columns giving the lower and upper confidence limits for each parameter.

See Also

confint, confint.nls in package MASS.

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))

## asymptotic ci's
confint(obj)
## Not run: 
## profile ci's (requires MASS)
confint(obj, method = "profile")

## End(Not run)

gslnls documentation built on May 29, 2024, 4:41 a.m.