get_draws_mle {rbmi} | R Documentation |
Fit the base imputation model on bootstrap samples
Description
Fit the base imputation model using a ML/REML approach on a given number of bootstrap samples as
specified by method$n_samples
. Returns the parameter estimates from the model fit.
Usage
get_draws_mle(
longdata,
method,
sample_stack,
n_target_samples,
first_sample_orig,
use_samp_ids,
failure_limit = 0,
ncores = 1,
quiet = FALSE
)
Arguments
longdata |
R6 |
method |
A |
sample_stack |
A stack object containing the subject ids to be used on each mmrm iteration. |
n_target_samples |
Number of samples needed to be created |
first_sample_orig |
Logical. If |
use_samp_ids |
Logical. If |
failure_limit |
Number of failed samples that are allowed before throwing an error |
ncores |
Number of processes to parallelise the job over |
quiet |
Logical, If |
Details
This function takes a Stack
object which contains multiple lists of patient ids. The function
takes this Stack and pulls a set ids and then constructs a dataset just consisting of these
patients (i.e. potentially a bootstrap or a jackknife sample).
The function then fits a MMRM model to this dataset to create a sample object. The function
repeats this process until n_target_samples
have been reached. If more than failure_limit
samples fail to converge then the function throws an error.
After reaching the desired number of samples the function generates and returns a draws object.
Value
A draws
object which is a named list containing the following:
-
data
: R6longdata
object containing all relevant input data information. -
method
: Amethod
object as generated by eithermethod_bayes()
,method_approxbayes()
ormethod_condmean()
. -
samples
: list containing the estimated parameters of interest. Each element ofsamples
is a named list containing the following:-
ids
: vector of characters containing the ids of the subjects included in the original dataset. -
beta
: numeric vector of estimated regression coefficients. -
sigma
: list of estimated covariance matrices (one for each level ofvars$group
). -
theta
: numeric vector of transformed covariances. -
failed
: Logical.TRUE
if the model fit failed. -
ids_samp
: vector of characters containing the ids of the subjects included in the given sample.
-
-
fit
: ifmethod_bayes()
is chosen, returns the MCMC Stan fit object. OtherwiseNULL
. -
n_failures
: absolute number of failures of the model fit. Relevant only formethod_condmean(type = "bootstrap")
,method_approxbayes()
andmethod_bmlmi()
. -
formula
: fixed effects formula object used for the model specification.