Relate › Nonlinear / curve fitting

Custom nonlinear formula

Fit an arbitrary user-typed nls formula. Provide the formula as 'y ~ …' and starting values as 'name=value, name=value, …'.

What is Custom nonlinear formula?

When none of the built-in models match, the custom-formula option lets you fit any parametric model nls() can converge on. The formula is parsed as a standard R formula; starting values are required and must be reasonable (nls is sensitive to bad starts).

Common pitfalls: missing starts ⇒ no convergence; starts that put the curve through implausible regions ⇒ local minima; over-parameterised models ⇒ unidentifiable. Start with a simpler model, verify convergence, then add parameters.

When should I use Custom nonlinear formula?

  • When the built-in library doesn't cover your model.
  • Field-specific functional forms with theoretical justification.

What data does it need?

Numeric X + Y + formula + starting values.

What does it report?

Standard nls fit table + CI/PI bands + ROUT-on-residuals outlier ID.

How do I interpret the result?

Convergence isn't enough — inspect the residual plot for systematic structure that suggests an inadequate model form before reporting parameter estimates.

See also