Learn R Programming

EMC2 (version 3.1.0)

predict.emc.prior: Generate Posterior/Prior Predictives

Description

Simulate n_post data sets using the posterior/prior parameter estimates

Usage

# S3 method for emc.prior
predict(object, data = NULL, n_post = 50, n_cores = 1, n_trials = NULL, ...)

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

Value

A list of simulated data sets of length n_post

Arguments

object

An emc or emc.prior object from which to generate predictives

data

A data frame needed to exactly match the original design

n_post

Integer. Number of generated datasets

n_cores

Integer. Number of cores across which there should be parallellized

n_trials

An integer. If data isn't provided (although preferred), can generate data based on n_trials per cell of design

...

Optional additional arguments passed to get_pars or make_data

hyper

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

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.

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