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.9949751 0.9899557 2.019045  7.130587      0.03130515    0.04730235
#> 2  1.0318434 1.0264235 1.923639  5.019422      0.03245836    0.04300403
#> 3  1.0061404 1.0089783 2.092968  6.925944      0.03190670    0.04766808
#> 4  0.9574418 0.9278591 2.023610  6.512844      0.02934148    0.04280953
#> 5  0.9995928 0.9756275 1.853696  4.541739      0.03085205    0.03946091
#> 6  0.9971444 1.0325341 1.983368  5.464365      0.03265160    0.04460968
#> 7  1.0193401 0.9656328 1.818538  4.702006      0.03053599    0.03953205
#> 8  1.0217978 0.9780189 1.658922  3.564306      0.03092767    0.03648387
#> 9  1.0543137 1.0398753 1.896702  4.803651      0.03288375    0.04289298
#> 10 0.9491824 0.9642585 1.982007  5.717452      0.03049253    0.04236008