negLL calculates log-normal negative log-likelihoods. It
expects the input parameters to be log-transformed, so the funk
used to calculate the log or the predicted values also needs to
expect log-transformed parameters. In addition, it checks that
there are no missing data (NA) within the input observed
log-transformed data. If there are it uses only those records
for which there are values.
Usage
negLL(pars, funk, logobs, ...)
Arguments
pars
the log-transformed parameters to be used in the funk for
calculating the log of the predicted values against which the log
observed values will be compared
funk
the function used to calculate the log-predicted values
of whatever variable is being used (eg. cpue, catches, etc.)
logobs
the observed values log-transformed ready for
comparison with the log-predicted values from funk and pars.
...
required to allow funk to access its other arguments
without having to explicitly declare them in negLL. In the
example below, indat is passed via the ...
Value
the negative log-likelihood using log-normal errors.
# NOT RUN {data(abdat) #expect an answer of -31.65035param <- log(c(r= 0.42,K=9400,Binit=3400,sigma=0.05))
negLL(pars=param,funk=simpspm,logobs=log(abdat[,"cpue"]),indat=abdat)
# }