Learn R Programming

EMC2 (version 2.1.0)

predict.emc: Generate posterior predictives

Description

Simulate n_post data sets using the posterior parameter estimates

Usage

# S3 method for emc
predict(
  object,
  hyper = FALSE,
  n_post = 100,
  n_cores = 1,
  stat = c("random", "mean", "median")[1],
  ...
)

Value

A list of simulated data sets of length n_post

Arguments

object

An emc object from which posterior predictives should be generated

hyper

Boolean. Defaults to FALSE. If TRUE, simulates from the group-level (hyper) parameters instead of the subject-level parameters.

n_post

Integer. Number of generated datasets

n_cores

Integer. Number of cores across which there should be parallellized

stat

Character. Can be mean, median or random (i.e., the default). Will take either random samples from the chain(s) or use the mean or median of the parameter estimates.

...

Optional additional arguments passed to get_pars or make_data

Examples

Run this code
# \donttest{
# based on an emc object ran by fit() we can generate posterior predictives
predict(samples_LNR, n_cores = 1, n_post = 10)
# }

Run the code above in your browser using DataLab