make_emc | R Documentation |
Creates an emc object by combining the data, prior,
and model specification into a emc
object that is needed in fit()
.
make_emc(
data,
design,
model = NULL,
type = "standard",
n_chains = 3,
compress = TRUE,
rt_resolution = 0.02,
prior_list = NULL,
par_groups = NULL,
...
)
data |
A data frame, or a list of data frames. Needs to have the variable |
design |
A list with a pre-specified design, the output of |
model |
A model list. If none is supplied, the model specified in |
type |
A string indicating whether to run a |
n_chains |
An integer. Specifies the number of mcmc chains to be run (has to be more than 1 to compute |
compress |
A Boolean, if |
rt_resolution |
A double. Used for compression, response times will be binned based on this resolution. |
prior_list |
A named list containing the prior. Default prior created if |
par_groups |
A vector. Only to be specified with type |
... |
Additional, optional arguments. |
An uninitialized emc object
dat <- forstmann
# function that takes the lR factor (named diff in the following function) and
# returns a logical defining the correct response for each stimulus. In this
# case the match is simply such that the S factor equals the latent response factor.
matchfun <- function(d)d$S==d$lR
# design an "average and difference" contrast matrix
ADmat <- matrix(c(-1/2,1/2),ncol=1,dimnames=list(NULL,"diff"))
# specify design
design_LBABE <- design(data = dat,model=LBA,matchfun=matchfun,
formula=list(v~lM,sv~lM,B~E+lR,A~1,t0~1),
contrasts=list(v=list(lM=ADmat)),constants=c(sv=log(1)))
# specify priors
pmean <- c(v=1,v_lMdiff=1,sv_lMTRUE=log(.5), B=log(.5),B_Eneutral=log(1.5),
B_Eaccuracy=log(2),B_lRright=0, A=log(0.25),t0=log(.2))
psd <- c(v=1,v_lMdiff=0.5,sv_lMTRUE=.5,
B=0.3,B_Eneutral=0.3,B_Eaccuracy=0.3,B_lRright=0.3,A=0.4,t0=.5)
prior_LBABE <- prior(design_LBABE, type = 'standard',pmean=pmean,psd=psd)
# create emc object
LBABE <- make_emc(dat,design_LBABE,type="standard", prior=prior_LBABE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.