Skip to contents

Computes a bayesian (hierarchical) piecewise linear model based on a Markov chain Monte Carlo sampler.

Usage

bplm(
  data,
  dvar,
  pvar,
  mvar,
  model = c("W", "H-M", "B&L-B"),
  contrast_level = c("first", "preceding"),
  contrast_slope = c("first", "preceding"),
  trend = TRUE,
  level = TRUE,
  slope = TRUE,
  random_trend = FALSE,
  random_level = FALSE,
  random_slope = FALSE,
  fixed = NULL,
  random = NULL,
  update_fixed = NULL,
  ...
)

# S3 method for class 'sc_bplm'
print(x, digits = 3, ...)

Arguments

data

A single-case data frame. See scdf() to learn about this format.

dvar

Character string with the name of the dependent variable. Defaults to the attributes in the scdf file.

pvar

Character string with the name of the phase variable. Defaults to the attributes in the scdf file.

mvar

Character string with the name of the measurement time variable. Defaults to the attributes in the scdf file.

model

Model used for calculating the dummy parameters (see Huitema & McKean, 2000). Default is model = "W". Possible values are: "B&L-B", "H-M", "W", and deprecated "JW".

contrast_level

Either "first", "preceding" or a contrast matrix. If NA contrast_level is a copy of contrast.

contrast_slope

Either "first", "preceding" or a contrast matrix. If NA contrast_level is a copy of contrast.

trend

A logical indicating if a trend parameters is included in the model.

level

A logical indicating if a level parameters is included in the model.

slope

A logical indicating if a slope parameters is included in the model.

random_trend

If TRUE, includes a random trend trend effect.

random_level

If TRUE, includes a random level trend effect.

random_slope

If TRUE, includes a random slope trend effect.

fixed

Defaults to the fixed part of the standard piecewise regression model. The parameter phase followed by the phase name (e.g., phaseB) indicates the level effect of the corresponding phase. The parameter 'inter' followed by the phase name (e.g., interB) adresses the slope effect based on the method provide in the model argument (e.g., "B&L-B"). The formula can be changed for example to include further L1 or L2 variables into the regression model.

random

The random part of the model.

update_fixed

An easier way to change the fixed model part (e.g., . ~ . + newvariable).

...

Further arguments passed to the mcmcglmm function.

x

An object returned by bplm()

digits

The minimum number of significant digits to be use. If set to "auto" (default), values are predefined.

Value

An object of class sc_bplm.

modelList containing infromation about the applied model.
NNumber of single-cases.
formulaA list containing the fixed and the random formulas of the hplm model.
mcmglmmObject of class MCMglmm.
contrastList with contrast definitions.

Functions

  • print(sc_bplm): Print results

See also

Other regression functions: autocorr(), corrected_tau(), hplm(), mplm(), plm(), trend()

Author

Juergen Wilbert

Examples

# bplm(Leidig2018)