tidy_samples: Get tidy samples with or without varying effects

Description Usage Arguments Value Author(s)

View source: R/mcpfit_methods.R

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

1
2
3
4
5
6
7
8
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 documentation built on Aug. 3, 2020, 5:07 p.m.