get_all_formulas: Call 'get_formula_str' for multiple ytypes and paste strings

View source: R/get_formula.R

get_all_formulasR Documentation

Call get_formula_str for multiple ytypes and paste strings


Currently used to differentiate between the JAGS model (use all) and the fit$simulate model (do not include arma).


get_all_formulas(ST, prior, par_x, ytypes = c("ct", "sigma", "arma"))



Tibble. Returned by get_segment_table.


Named list. Names are parameter names (cp_i, int_i, xvar_i, 'sigma“) and the values are either

  • A JAGS distribution (e.g., int_1 = "dnorm(0, 1) T(0,)") indicating a conventional prior distribution. Uninformative priors based on data properties are used where priors are not specified. This ensures good parameter estimations, but it is a questionable for hypothesis testing. mcp uses SD (not precision) for dnorm, dt, dlogis, etc. See details. Change points are forced to be ordered through the priors using truncation, except for uniform priors where the lower bound should be greater than the previous change point, dunif(cp_1, MAXX).

  • A numerical value (e.g., int_1 = -2.1) indicating a fixed value.

  • A model parameter name (e.g., int_2 = "int_1"), indicating that this parameter is shared - typically between segments. If two varying effects are shared this way, they will need to have the same grouping variable.

  • A scaled Dirichlet prior is supported for change points if they are all set to ⁠cp_i = "dirichlet(N)⁠ where N is the alpha for this change point and N = 1 is most often used. This prior is less informative about the location of the change points than the default uniform prior, but it samples less efficiently, so you will often need to set iter higher. It is recommended for hypothesis testing and for the estimation of more than 5 change points. Read more.


String (default: NULL). Only relevant if no segments contains slope (no hint at what x is). Set this, e.g., par_x = "time".


A character vector of ytypes to including in model building


A string with JAGS code.


Jonas Kristoffer Lindeløv

mcp documentation built on April 1, 2023, 12:03 a.m.