objectiveFunction | R Documentation |
Calculates the negative log likelihood of a model given a calibrated date matrix
objectiveFunction(pars, PDarray, type, timeseries=NULL)
pars |
A numeric vector of parameters. |
PDarray |
A data frame typically generated by |
type |
Choose from the following currently available |
timeseries |
Only if 'type' = 'timeseries', a data frame should be provided containing columns x and y that define the timeseries as year and value respectively. |
If type is 'CPL', pars must be an odd length each between 0 and 1 since parameters correspond to: (y,x,...y). If type is 'exp', pars must be a single positive or negative numeric (the exponential rate can be growth or decay). Typically this parameter should be close to zero (-0.1 to 0.1) to avoid numbers beyond floating point limits) If type is 'norm', pars must have length 2 (mean and sd) If type is 'uniform', then pars must be NA.
Returns a single value, the negative log likelihood.
# generate a PD array from a handful of dates
data <- subset(SAAD, site %in% c('Carrizal','Pacopampa'))
CalArray <- makeCalArray(shcal13, calrange = c(2000,6000))
PD <- phaseCalibrator(data, CalArray)
# the negative log likelihood given some random parameters for a 3-CPL model
pars <- runif(5)
objectiveFunction(pars, PD, type='CPL')
# the negative log likelihood given a random exponential model
pars <- runif(1, -0.01, 0.01)
objectiveFunction(pars, PD, type='exp')
# the negative log likelihood given a random Gaussian model
pars <- c(runif(1, 2000, 6000), runif(1, 100, 1000))
objectiveFunction(pars, PD, type='norm')
# the negative log likelihood given a uniform model
objectiveFunction(pars=NA, PD, type='uniform')
# the negative log likelihood given a uniform model with taphonomy
pars <- c(NA, runif(1, 0, 20000), runif(1, -3, 0))
objectiveFunction(pars=pars, PD, type=c('uniform','power'))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.