summarise: Summarise posterior distributions

Description Usage Arguments Details See Also Examples

Description

summarise() can be used to apply a function simulationwise. This is especially useful to create posterior summaries of your paramaters.

Usage

1
2
3
4
5
6
## S3 method for class 'sims'
summarise_(.data, ..., .dots, .context = list(),
  .escaped = NULL)

## S3 method for class 'stanfit'
summarise_(.data, ..., .dots, .context = list())

Arguments

.data

A list of simulations arrays.

...

Name-value pairs of expressions.

.dots

Used to work around non-standard evaluation. See dplyr's vignette("nse") for details.

.context

Additional data on which expressions depend.

.escaped

Names of functions that should be escaped in addition to the binary operators.

Details

gsim's summarise() method is different from the one in dplyr in several respects. While dplyr's method discards non-relevant columns, gsim's method keeps all data. sims objects can contain both simulation arrays and ordinary objects. summarise() makes use of this possibility by adding the summarised quantities alongside the posterior arrays.

Note that the functions mentioned in ... are applied across the posterior simulations. If you need to transform your quantities datawise, mention the relevant functions in .escaped (though it is generally better to transform beforehand with mutate()). All binary operators such as + or ^ are escaped by default because it doesn't make sense to apply them across simulations.

See Also

across_sims()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library("dplyr")

radon_sims %>%
  summarise(
    sigma_lower = mean(sigma) - sd(sigma),
    sigma_m = mean(sigma),
    sigma_upper = sigma_m + sd(sigma),
    sigma_975 = q975(sigma),
    sigma_025 = q025(sigma)
  )

radon_sims %>% summarise(sigma_est = mean_sd(Beta))

lionel-/gsim documentation built on May 21, 2019, 6:41 a.m.