Shortcut for summarize variable with quantiles and mean

summarise_posterior(data, var, ...)

Arguments

data

tidy data frame

var

variable name (unquoted) to be summarised

...

other expressions to pass to summarise

Value

data.frame

Details

Notation: pX refers to the X% quantile

Examples

d <- data.frame("a"=sample(1:10, 50, TRUE), "b"=rnorm(50)) # Summarize posterior for b over grouping of a and also calcuate # minmum of b (in addition to normal statistics returned) d <- dplyr::group_by(d, a) summarise_posterior(d, b, mean.b = mean(b), min=min(b))
#> # A tibble: 10 x 9 #> a p2.5 p25 p50 mean p75 p97.5 mean.b min #> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 1 -0.706 -0.547 -0.370 -0.244 -0.00479 0.324 -0.244 -0.723 #> 2 2 -0.366 -0.253 0.168 0.252 0.673 1.01 0.252 -0.379 #> 3 3 -1.43 -0.903 -0.314 -0.562 -0.0961 0.100 -0.562 -1.49 #> 4 4 -0.375 -0.247 0.0286 0.00631 0.252 0.367 0.00631 -0.390 #> 5 5 -0.697 -0.113 0.509 0.375 0.612 1.68 0.375 -0.739 #> 6 6 -0.921 -0.439 -0.0193 0.100 0.629 1.12 0.100 -1.02 #> 7 7 -1.54 -1.44 -1.33 -1.33 -1.22 -1.12 -1.33 -1.55 #> 8 8 -0.674 -0.633 -0.315 -0.161 -0.00122 0.740 -0.161 -0.679 #> 9 9 -1.22 -1.01 -0.786 -0.786 -0.557 -0.351 -0.786 -1.24 #> 10 10 -0.941 -0.716 -0.141 -0.0437 0.271 1.30 -0.0437 -0.983