fitted.gsl_nls: Extract model fitted values

View source: R/nls_methods.R

fitted.gsl_nlsR Documentation

Extract model fitted values

Description

Returns the fitted responses from a "gsl_nls" object. fitted.values can also be used as an alias.

Usage

## S3 method for class 'gsl_nls'
fitted(object, ...)

Arguments

object

An object inheriting from class "gsl_nls".

...

At present no optional arguments are used.

Value

Numeric vector of fitted responses similar to fitted.

See Also

fitted

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

fitted(obj)

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