ssq | R Documentation |
ssq is a generalized function for summing squared residuals which is designed for ease of use in optim (or dfoptim's nmk)
ssq(inp, indat, callfun)
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 |
a single number (scaler) that is the sum of squared residuals between the obs cpue and those calculated by infun
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.