prior | R Documentation |
These values are entered manually by default but can be recycled from another prior (given in the update
argument).
prior(
design,
type = NULL,
update = NULL,
do_ask = NULL,
fill_default = TRUE,
...
)
design |
Design list for which a prior is constructed, typically the output of |
type |
Character. What type of group-level model you plan on using i.e. |
update |
Prior list from which to copy values |
do_ask |
Character. For which parameter types or hyperparameters to ask for prior specification,
i.e. |
fill_default |
Boolean, If |
... |
Either values to prefill, i.e. |
Where a value is not supplied, the user is prompted to enter numeric values (or functions that evaluate to numbers).
To get the prior help use prior_help(type)
. With type
e.g. 'diagonal'.
A prior list object
# First define a design for the model
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 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)
# Also add a group-level variance prior:
pscale <- c(v_Sleft=.6,v_Sright=.6,a=.3,a_Eneutral=.3,a_Eaccuracy=.3,
t0=.2,Z=.5,sv=.4,SZ=.3)
df <- .4
prior_DDMaE <- prior(design_DDMaE,mu_mean=p_vector,mu_sd=psd, A = pscale, df = df)
# If we specify a new design
design_DDMat0E <- design(data = forstmann,model=DDM,
formula =list(v~0+S,a~E, t0~E, s~1, Z~1, sv~1, SZ~1),
constants=c(s=log(1)))
# We can easily update the prior
prior_DDMat0E <- prior(design_DDMat0E, update = prior_DDMaE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.