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 sd.mc_std_err mean.mc_std_err
#> 1  1.0029053 1.0172244 2.178827  7.268681    0.04897141      0.03526468
#> 2  0.9535002 0.9200231 1.587923  2.649969    0.03137525      0.03107803
#> 3  0.9989811 0.9978925 2.017936  6.236392    0.04528715      0.03442034
#> 4  1.0112974 0.9646196 1.703112  3.601604    0.03610438      0.03278739
#> 5  0.9754490 0.9624091 1.673209  3.037352    0.03415994      0.03259451
#> 6  1.0055346 1.0571036 2.310578  7.825628    0.05239767      0.03674247
#> 7  0.9595199 0.9441211 1.984422  5.567403    0.04107037      0.03245325
#> 8  1.0632556 1.0494500 1.868521  4.802360    0.04328381      0.03592403
#> 9  1.0531084 1.1236150 2.332426  8.157151    0.05662605      0.03911317
#> 10 1.0303214 0.9924695 1.619712  2.774731    0.03429673      0.03355376