tidy_samples: Get tidy samples with or without varying effects

View source: R/mcpfit_methods.R

tidy_samplesR Documentation

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

One of:

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

  • FALSE No varying effects (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 documentation built on May 29, 2024, 6:15 a.m.