produce_model_function: Produce an object with model-specific functions and...

View source: R/create_model_info.r

produce_model_functionR Documentation

Produce an object with model-specific functions and arguments.

Description

This internal function takes the model type, parsed formula, inference, and extra args and returns a list with all of the specific information (e.g., extra functions) needed to run the model. The output is used in the frequentist and Bayesian internal model run functions.

Usage

produce_model_function(
  model.type,
  formula.parsed,
  inference,
  model.extra.args = NULL,
  main.ivs = NULL
)

Arguments

model.type

The type of model to run.

formula.parsed

The parsed formula object.

inference

Whether the model should be run using 'frequentist' or 'Bayesian' inference.

model.extra.args

Extra arguments passed to the function used to run the model.

main.ivs

A list of the main effects (e.g., a treatment) that the analysis is focused on. Used on to identify if a survival model has time-varying hazards.

Value

Based on the type of model to run and the statistical inference used, this function returns a list of model-specific functions and flags that allow the model to be easily run.

The functions model_run.frequentist' and 'model_run.bayesian' take the returns from this function and actually run the model. For a frequentist approach the model is run once for each random sample of the main data. For the Bayesian approach the model is run once for each chain.

See Also

Other model setup functions: determine_model(), identify_tve(), parse_formula()


jacobaro/danalyze documentation built on Oct. 20, 2022, 8:09 a.m.