get_segment_table: Build a table describing a list of segments

View source: R/get_segment_table.R

get_segment_tableR Documentation

Build a table describing a list of segments

Description

Used internally for most mcp functions.

Usage

get_segment_table(model, data = NULL, family = gaussian(), par_x = NULL)

Arguments

model

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

Data.frame or tibble in long format.

family

One of gaussian(), binomial(), bernoulli(), or poission(). Only default link functions are currently supported.

par_x

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

Value

A tibble with one row describing each segment and the corresponding code.

Author(s)

Jonas Kristoffer Lindeløv jonas@lindeloev.dk

Examples

model = list(
  y ~ 1 + x,
  1 + (1|id) ~ 1
)
get_segment_table(model)

mcp documentation built on May 29, 2024, 6:15 a.m.