The function prepares the data, draws and alternative availabilites for estimation. All model components are placed in an estimation environment which provides the context for evaluating the log likelihood function.

prepare(
  ll,
  db,
  model_options,
  control = NULL,
  check_data = TRUE,
  debug = FALSE,
  ...
)

Arguments

ll

A user supplied log-likelihood function

db

A data.frame() or tibble() containing the data

model_options

A list of user supplied model options. This list is validated within the function. See validate for details.

control

A list of control options

check_data

A boolean equal to TRUE if we should run data checks and pad the data with NA.

debug

A boolean equal to TRUE if you are debugging the log likelihood function. It forces the number of cores to 1. Then you can simply attach the estimation environment and the list of parameters to run the log likelihood function line by line. The default is FALSE.

...

Additional named arguments that are added to the estimation environment. If cores > 1 the arguments are added to each individual estimation environment. No attempts at splitting across cores. This is useful if you need to pass e.g. a restriction matrix or other variables to the estimation environment so that they can be called by name/reference within the log-likelihood function.

Value

The estimation environment or a list of estimation environments if cores > 1.