residuals.gsl_nls: Extract model residuals

View source: R/nls_methods.R

residuals.gsl_nlsR Documentation

Extract model residuals

Description

Returns the model residuals from a fitted "gsl_nls" object. resid can also be used as an alias.

Usage

## S3 method for class 'gsl_nls'
residuals(object, type = c("response", "pearson"), ...)

Arguments

object

An object inheriting from class "gsl_nls".

type

character; if "response" the raw residuals are returned, if "pearson" the Pearson are returned, i.e. the raw residuals divided by their standard error.

...

At present no optional arguments are used.

Value

Numeric vector of model residuals similar to residuals.

See Also

residuals

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

residuals(obj)

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