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 mapbayests object.

update_omega

Update the OMEGA matrix with the variance-covariance matrix of estimation (a logical, default is FALSE).

update_cov

Update the values of covariates with the individual values (a logical, default is TRUE).

update_eta

Update the values of ETA with the final estimates (a logical, default is TRUE).

.zero_re

Set all elements of the OMEGA or SIGMA matrix to zero. Default is "both" if update_omega is FALSE, "sigma" otherwise. (possible values are "both", "sigma", "omega", "none")

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:

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()


[Package mapbayr version 0.10.0 Index]