sma_summarise: Apply R code to each element of an nlist object. This can be...

View source: R/simanalyse-summarise.R

sma_summariseR Documentation

Apply R code to each element of an nlist object. This can be used to derive new variables or create some missing data in the simulated data or in the results of the analyses.

Description

Derive new variables from the results of analyses

Usage

sma_summarise(
  object,
  measures = c("mean", "lower.q", "upper.q"),
  monitor = ".*",
  alpha = 0.05,
  custom_funs = list()
)

Arguments

object

An mcmcr or mcmcrs object.

measures

A vector of strings indicating which functions to calculate over the mcmc samples. Strings may include "mean", "median", "lower.q" (lower bound of the quantile-based credible interval), "upper.q" (upper bound of the quantile-based credible interval), "var", "sd", "q1" (1st quartile), "q3" (3rd quartile)

monitor

A character vector (or regular expression if a string) specifying the names of the variables in object and/or code to monitor. By default all variables are included.

alpha

scalar representing the alpha level used to construct credible intervals. Default is 0.05.

custom_funs

A named list of functions to calculate over the mcmc samples. This optional argument can be used to calculate measures that cannot be specified through measures. E.g. list(posteriormedian = median).

Value

A flag.


audrey-b/simanalyse documentation built on May 20, 2022, 7:45 p.m.