View source: R/cogmod_stanvars.R
| cogmod_stanvars | R Documentation |
Returns the stanvars argument for brms::brm(), for whichever cogmod
family the model uses. It is a front end to the per-family
<family>_stanvars() functions - cogmod_lognormal_stanvars(),
cogmod_choco_stanvars(), cogmod_ddm_stanvars() and the rest - which remain available
and unchanged.
cogmod_stanvars(formula, ...)
formula |
A |
... |
Passed to the family's own |
brms needs the custom likelihood injected into the generated Stan program,
and every cogmod family ships one. Calling this instead of the family's own
function means the family is named once, in bf(), rather than twice:
f <- brms::bf(RT ~ Condition, ndt ~ Condition,
family = cogmod_lognormal())
brms::brm(f, data = df,
prior = cogmod_priors(f, df),
init = cogmod_inits(f, df),
stanvars = cogmod_stanvars(f))
A stanvars object, to pass to brms::brm(stanvars = ).
cogmod_lba1() and cogmod_lba2() have a likelihood that is exactly
constant along the ray that multiplies the drift rates, their SDs, the
start-point range and the threshold offset by a common factor. If the
formula pins none of them to a constant, this warns: the RT distribution is
still identified, but the individual parameters are not, and the fit will
converge to whatever the priors say about that direction rather than fail.
Fixing any one member in bf() - conventionally sigmazero = 1 - silences
it. Leaving a parameter out of bf() does not count: brms estimates it
anyway.
A brms::bf() formula carrying the family, the family object itself, or a
fitted brmsfit (useful for recompiling or for update()).
cogmod_priors(), cogmod_inits()
f <- brms::bf(RT ~ 1, ndt ~ 1, family = cogmod_lognormal())
cogmod_stanvars(f)
# Equivalent to naming the family a second time:
cogmod_lognormal_stanvars()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.