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
longdata
object containing all relevant input data information.- method
A
method
object as generated by eithermethod_approxbayes()
ormethod_condmean()
with argumenttype = "bootstrap"
.- 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
TRUE
the function returnsmethod$n_samples + 1
samples where the first sample contains the parameter estimates from the original dataset andmethod$n_samples
samples contain the parameter estimates from bootstrap samples. IfFALSE
the function returnsmethod$n_samples
samples containing the parameter estimates from bootstrap samples.- use_samp_ids
Logical. If
TRUE
, the sampled subject ids are returned. Otherwise the subject ids from the original dataset are returned. These values are used to tellimpute()
what subjects should be used to derive the imputed dataset.- 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
TRUE
will suppress printing of progress information that is printed to the console.
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.
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.