Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

tidy_samples

Get tidy samples with or without varying effects


Description

Returns in a format useful for fit$simulate() with population parameters in wide format and varying effects in long format (the number of rows will be nsamples * n_levels_in_varying).

Usage

tidy_samples(
  fit,
  population = TRUE,
  varying = TRUE,
  absolute = FALSE,
  prior = FALSE,
  nsamples = NULL
)

Arguments

fit

An mcpfit object

population
  • TRUE: All population effects. Same as fit$pars$population.

    • FALSE: No population effects. Same as c().

    • Character vector: Only include specified population parameters - see fit$pars$population.

varying
  • TRUE: All varying effects (fit$pars$varying).

    • FALSE: No varying efects (c()).

    • Character vector: Only include specified varying parameters - see fit$pars$varying.

absolute
  • TRUE: Returns the absolute location of all varying change points.

    • FALSE: Just returns the varying effects.

    • Character vector: Only do absolute transform for these varying parameters - see fit$pars$varying.

    OBS: This currently only applies to varying change points. It is not implemented for rel() regressors yet.

prior

TRUE/FALSE. Summarise prior instead of posterior?

nsamples

Integer or NULL. Number of samples to return/summarise. If there are varying effects, this is the number of samples from each varying group. NULL means "all". Ignored if both are FALSE. More samples trade speed for accuracy.

Value

tibble of posterior draws in tidybayes format.

Author(s)

Jonas Kristoffer Lindeløv jonas@lindeloev.dk


mcp

Regression with Multiple Change Points

v0.3.0
GPL-2
Authors
Jonas Kristoffer Lindeløv [aut, cre] (<https://orcid.org/0000-0003-4565-0595>)
Initial release
2020-07-27

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.