From a combination of arguments and the user specified priors, creates the final list of expressions that rethinking::ulam uses to build the stan model block. Currently only allows additive normal model with all media transformations applied before the regression is run. Currently only allows for random intercepts.

create_ulam_list(
  prior_controls = var_controls,
  model_formula = built_formula,
  rand_int_prior_mean = 65,
  main_error_term_prior = "half_cauchy(0,100)",
  grand_intercept_prior = "normal(50,50)",
  random_int_stdev_prior = "half_cauchy(0,10)",
  random_slope_stdev_prior = "half_cauchy(0,10)",
  unspecified_priors = "normal(0,10)"
)

Arguments

prior_controls

Defaults to var_controls; a tibble containing start_name and varname, prior, and prior_sd, where the column prior is the mean of a normal dist.

model_formula

Defaults to the object built_formula; a string containing the model formula in the style of lmer.

rand_int_prior_mean

defaults to 65; the mean of the prior (normal) for random intercepts. If there are two groups of 'random intercepts' this will apply to both.

main_error_term_prior

defaults to 'half_cauch(0,100)'; should be a sampling distribution from stan and becomes the prior on the residual error

grand_intercept_prior

defaults to 'normal(50,50)'; is a string defining a sampling distribution from stan and becomes the prior on the intercept in the regression

random_int_stdev_prior

defaults to 'half_cauchy(0,10)'; is a string defining the sampling distribution of the std deviation of any included random intercepts. If there are two groups of 'random intercepts' this will apply to both.

random_slope_stdev_prior

defaults to half_cauch(0,10); should be a string describing a stan sampling distribution and is used to define the spread in any random slopes in the model

unspecified_priors

defaults to 'normal(0,10)'; should be a stan sampling distribution that defines the 'uninformative' prior to use when no other prior is speciied.

Value

a list of expressions suitable for use as the formula list in rethinking::ulam