The pre-calculates a set of matrices that will be re-used through the Gibbs chains. These calculations can be slow for large models, especially if n is large, the number of random effects is > 1, or there are many groups of observations with different missing data patterns.

initialize_MegaLMM(
  MegaLMM_state,
  ncores = my_detectCores(),
  Qt_list = NULL,
  chol_R_list = NULL,
  chol_ZKZt_list = NULL,
  verbose = TRUE
)

Arguments

MegaLMM_state

MegaLMM_state object as returned by setup_model_MegaLMM

ncores

number of cores to use for parallel evaluations. Not really used as RcppParallel is used instead. Instead, we break up the computation into chunks of this size.

Qt_list

Optionally, Qt_list, chol_R_list and chol_ZKZt_list can be provided from a previous MegaLMM_state object if the data and model is identical.

chol_R_list

See Qt_list

chol_ZKZt_list

See Qt_list

diagonalize_ZtZ_Kinv

Should a matrix S be calculated to simultaneously diagonalize ZtZ and Kinv? This only works with a single random effect, and may slow down the computation some, but with large sample size can dramatically reduce the memory footprint.

Value

MegaLMM_state object with Qt_list, chol_R_list and chol_ZKZt_list added to run_variables