ssq: ssq a generalized function for summing squared residuals

View source: R/spm.r

ssqR Documentation

ssq a generalized function for summing squared residuals

Description

ssq is a generalized function for summing squared residuals which is designed for ease of use in optim (or dfoptim's nmk)

Usage

ssq(inp, indat, callfun)

Arguments

inp

a vector of parameters used by the input function 'funk'

indat

the data set containing the 'year', 'catch', and 'cpue'

callfun

the function that calculates the predicted values from the input data

Value

a single number (scaler) that is the sum of squared residuals between the obs cpue and those calculated by infun

Examples

## Not run: 
data(dataspm)
fish <- dataspm$fish
fish
colnames(fish) <- tolower(colnames(fish)) 
pars <- c(r=0.2,K=6000,Binit=2800)
ssq(pars,fish,simpfox)  # should be 1.713938
ssq(pars,fish,simpspm)  # should be 0.8856442

## End(Not run)

haddonm/datalowSA documentation built on Nov. 5, 2023, 6:40 p.m.