Learn R Programming

EMC2 (version 3.1.0)

parameters.emc.prior: Return Data Frame of Parameters

Description

Return Data Frame of Parameters

Usage

# S3 method for emc.prior
parameters(x, selection = "mu", N = 1000, covariates = NULL, ...)

# S3 method for emc parameters(x, selection = "mu", N = NULL, resample = FALSE, ...)

parameters(x, ...)

Value

A data frame with one row for each sample (with a subjects column if selection = "alpha" and using draws from the posterior)

Arguments

x

An emc or emc.prior object

selection

String designating parameter type (e.g. mu, sigma2, correlation, alpha)

N

Integer. How many samples to take from the posterior/prior. If NULL will return the full posterior

covariates

For priors, possible covariates in the design

...

Optional arguments that can be passed to get_pars

resample

Boolean. If TRUE will sample N samples from the posterior with replacement

Examples

Run this code
# For prior inference:
# First set up a prior
design_DDMaE <- design(data = forstmann,model=DDM,
                       formula =list(v~0+S,a~E, t0~1, s~1, Z~1, sv~1, SZ~1),
                       constants=c(s=log(1)))
# Then set up a prior using make_prior
p_vector=c(v_Sleft=-2,v_Sright=2,a=log(1),a_Eneutral=log(1.5),a_Eaccuracy=log(2),
           t0=log(.2),Z=qnorm(.5),sv=log(.5),SZ=qnorm(.5))
psd <- c(v_Sleft=1,v_Sright=1,a=.3,a_Eneutral=.3,a_Eaccuracy=.3,
         t0=.4,Z=1,sv=.4,SZ=1)
# Here we left the variance prior at default
prior_DDMaE <- prior(design_DDMaE,mu_mean=p_vector,mu_sd=psd)
# Get our prior samples
parameters(prior_DDMaE, N = 100)
# For posterior inference:
# Get 100 samples of the group-level mean (the default)
parameters(samples_LNR, N = 100)
# or from the individual-level parameters and mapped
parameters(samples_LNR, selection = "alpha", map = TRUE)

Run the code above in your browser using DataLab