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.
get_draws_mle(
longdata,
method,
sample_stack,
n_target_samples,
first_sample_orig,
use_samp_ids,
failure_limit = 0,
ncores = 1,
quiet = FALSE
)
A draws
object which is a named list containing the following:
data
: R6 longdata
object containing all relevant input data information.
method
: A method
object as generated by either method_bayes()
,
method_approxbayes()
or method_condmean()
.
samples
: list containing the estimated parameters of interest.
Each element of samples
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 of vars$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
: if method_bayes()
is chosen, returns the MCMC Stan fit object. Otherwise NULL
.
n_failures
: absolute number of failures of the model fit.
Relevant only for method_condmean(type = "bootstrap")
, method_approxbayes()
and method_bmlmi()
.
formula
: fixed effects formula object used for the model specification.
R6 longdata
object containing all relevant input data information.
A method
object as generated by either
method_approxbayes()
or method_condmean()
with argument type = "bootstrap"
.
A stack object containing the subject ids to be used on each mmrm iteration.
Number of samples needed to be created
Logical. If TRUE
the function returns method$n_samples + 1
samples where
the first sample contains the parameter estimates from the original dataset and method$n_samples
samples contain the parameter estimates from bootstrap samples.
If FALSE
the function returns method$n_samples
samples containing the parameter estimates from
bootstrap samples.
Logical. If TRUE
, the sampled subject ids are returned. Otherwise
the subject ids from the original dataset are returned. These values are used to tell impute()
what subjects should be used to derive the imputed dataset.
Number of failed samples that are allowed before throwing an error
Number of processes to parallelise the job over
Logical, If TRUE
will suppress printing of progress information that is printed to
the console.
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.