find_glm_map_parameter_estimates: Get Maximum a Priori (MAP) parameter estimates

Description Usage Arguments Value

View source: R/model_functions.R

Description

Find the Maximum a Priori (MAP) estimates for fixed effect parameter values, including age-specific fixed effects, in a simplified version of a GLM. Starting the full TMB model with fixed effect starting values set at the MAP has been shown to improve performance and run time.

Usage

1
2
3
4
5
6
7
8
find_glm_map_parameter_estimates(
  in_data,
  events_field,
  exposure_field,
  covar_names,
  distribution_family,
  grouping_field = NULL
)

Arguments

in_data

Input data.table, including only the data used to train the model. Fields must include a numerator, a denominator, fields named for all covariates, and (optionally) an age ID field

events_field

Field name for the number of events (eg deaths)

exposure_field

Field name for the relative exposure (eg. pop-time)

covar_names

Names of all covariates, including 'intercept' if desired

distribution_family

Name of the distribution to to fit the GLM with, which also determines the link function to be used. Should be a valid argument to pass to 'stats::glm(family = distribution_family)'

grouping_field

[optional] Field that groups observations by ID

Value

Named list with two items: - "glm_fit": Full model fit for the GLM - "fixed_effects_map": Maximum a priori estimates for covariate fixed effects, organized as a named numeric vector - "fixed_effects_grouping": Maximum a priori estimates for grouped fixed effects, organized as a vector of length(num groups). This list item is NULL if the argument 'grouping_field' was not specified


njhenry/covidemr documentation built on Feb. 2, 2022, 2:31 a.m.