Used internally for most mcp functions.
get_segment_table(model, data = NULL, family = gaussian(), par_x = NULL)A tibble with one row describing each segment and the corresponding code.
A list of formulas - one for each segment. The first formula
has the format response ~ predictors while the following formulas
have the format response ~ changepoint ~ predictors. The response
and change points can be omitted (changepoint ~ predictors assumes same
response. ~ predictors assumes an intercept-only change point). The
following can be modeled:
Regular formulas: e.g., ~ 1 + x). Read more.
Extended formulas:, e.g., ~ I(x^2) + exp(x) + sin(x). Read more.
Variance: e.g., ~sigma(1) for a simple variance change or
~sigma(rel(1) + I(x^2))) for more advanced variance structures. Read more
Autoregression: e.g., ~ar(1) for a simple onset/change in AR(1) or
ar(2, 0 + x) for an AR(2) increasing by x. Read more
Data.frame or tibble in long format.
One of gaussian(), binomial(), bernoulli(), or poission().
Only default link functions are currently supported.
String (default: NULL). Only relevant if no segments contains slope (no hint at what x is). Set this, e.g., par_x = "time".
Jonas Kristoffer Lindeløv jonas@lindeloev.dk
model = list(
y ~ 1 + x,
1 + (1|id) ~ 1
)
get_segment_table(model)
Run the code above in your browser using DataLab