Skip to contents

Summarise and annotate data

Usage

bru_summarise(
  data,
  probs = c(0.025, 0.5, 0.975),
  x = NULL,
  cbind.only = FALSE,
  max_moment = 2
)

Arguments

data

A list of samples, each either numeric or a data.frame

probs

A numeric vector of probabilities with values in [0, 1], passed to stats::quantile

x

A data.frame of data columns that should be added to the summary data frame

cbind.only

If TRUE, only cbind the samples and return a matrix where each column is a sample

max_moment

integer, at least 2. Determines the largest moment order information to include in the output. If max_moment > 2, includes "skew" (skewness, E[(x-m)^3/s^3]), and if max_moment > 3, includes "ekurtosis" (excess kurtosis, E[(x-m)^4/s^4] - 3). Default 2. Note that the Monte Carlo variability of the ekurtois estimate may be large.

Value

A data.frame or Spatial[Points/Pixels]DataFrame with summary statistics, "mean", "sd", paste0("q", probs), "mean.mc_std_err", "sd.mc_std_err"

Examples

bru_summarise(matrix(rexp(10000), 10, 1000), max_moment = 4, probs = NULL)
#>         mean        sd     skew ekurtosis mean.mc_std_err sd.mc_std_err
#> 1  0.9567267 0.9153892 1.724463  3.954266      0.02894715    0.03532343
#> 2  1.0105574 0.9716045 2.229133  8.371640      0.03072483    0.04947949
#> 3  1.0416183 1.0119451 1.818172  4.186975      0.03200051    0.03980488
#> 4  0.9148255 0.8874611 1.974755  6.249137      0.02806399    0.04030661
#> 5  0.9372708 0.8952041 1.878677  4.833863      0.02830884    0.03700742
#> 6  1.0325237 0.9676276 1.642778  3.280130      0.03059907    0.03516275
#> 7  0.9945650 1.0071473 2.606914 13.630249      0.03184879    0.06296131
#> 8  0.9859730 0.9994783 2.153229  7.379777      0.03160628    0.04840453
#> 9  0.9830072 0.9609653 1.795127  4.171517      0.03038839    0.03775236
#> 10 0.9704915 0.9642609 1.998875  5.593682      0.03049261    0.04201922