use_posterior {mapbayr} | R Documentation |
Use posterior estimation
Description
Use posterior estimation
Usage
use_posterior(
x,
update_omega = FALSE,
update_cov = TRUE,
update_eta = TRUE,
.zero_re = NULL,
simplify = TRUE
)
Arguments
x |
A |
update_omega |
Update the OMEGA matrix with the variance-covariance matrix of estimation (a logical, default is |
update_cov |
Update the values of covariates with the individual values (a logical, default is |
update_eta |
Update the values of ETA with the final estimates (a logical, default is |
.zero_re |
Set all elements of the OMEGA or SIGMA matrix to zero. Default is "both" if |
simplify |
a logical. If TRUE (the default) and only one ID, one mrgmod is returned instead of a list of length 1 |
Details
This function takes the results of an estimation (i.e. a mapbayests
object) and return a modified mrgmod
in order to perform a posteriori simulations. Modifications are:
If
update_eta
isTRUE
, the values of ETA are updated to the estimated values (instead of 0) in $PARAM.If
update_cov
isTRUE
, the covariates values are updated to the values of the individual (instead of default model values) in $PARAM.If
update_omega
isTRUE
, the values of OMEGA are updated with the variance-covariance matrix of estimation (i.e. an approximation of the a posteriori distribution) instead of the inter-individual variability (i.e. the a priori distribution). Use this command in order to derive a confidence interval of concentrations that reflects the uncertainty about parameter estimation when a large number of profiles are simulated. Note that if inter-individual variability was initially defined in multiple $OMEGA blocks in the model, they will be collapsed to a single full matrix (this is irreversible).Depending on the values of
.zero_re
, the elements of $OMEGA or $SIGMA can be set to zero, whether you want to simulate one profile, or several in order to derive confidence/prediction intervals. It does not handle time-varying covariates: only the first value will be used as the individual value.
Value
a mrgmod, or a list of mrgmod if there is more than 1 ID
Examples
library(magrittr)
est <- mapbayest(exmodel())
est %>%
use_posterior() %>%
mrgsolve::ev(amt = 50000) %>%
mrgsolve::mrgsim()