formula.gsl_nls: Extract model formula

View source: R/nls_methods.R

formula.gsl_nlsR Documentation

Extract model formula

Description

Returns the model formula from a fitted "gsl_nls" object.

Usage

## S3 method for class 'gsl_nls'
formula(x, ...)

Arguments

x

An object inheriting from class "gsl_nls".

...

At present no optional arguments are used.

Value

If the object inherits from class "nls" returns the fitted model as a formula similar to formula. Otherwise returns the fitted model as a function.

See Also

formula

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

formula(obj)

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