Learn R Programming

gslnls (version 1.4.1)

confint.gsl_nls: 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 gsl_nls
confint(object, parm, level = 0.95, method = c("asymptotic", "profile"), ...)

Value

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

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".

See Also

confint, confint.nls in package MASS.

Examples

Run this code
## 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)
if (FALSE) {
## profile ci's (requires MASS)
confint(obj, method = "profile")
}

Run the code above in your browser using DataLab