Learn R Programming

growthrates (version 0.8.4)

cost: Cost Function for Nonlinear Fits

Description

Defines a cost function from the residual sum of squares between model and observational data.

Usage

cost(p, obs, FUN, fixed.p = NULL, transform, ...)

Value

an object of class modCost, see modCost in package FME

Arguments

p

vector of fitted parameters of the growth model.

FUN

function of growth model to be fitted.

fixed.p

vector of fixed parameters of the growth model.

...

additional parameters passed to the optimizer.

Details

Function 'cost' is implemented along the lines of the following template, see package FME for details:


cost <- function(p, obs, FUN, fixed.p = NULL, ...) {
  out <- FUN(obs$time, c(p, fixed.p))
  modCost(out, obs, weight = "none", ...)
}