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 mean.mc_std_err sd.mc_std_err ekurtosis
#> 1  1.0050534 1.0195641 2.170097      0.03533472    0.04890899  7.202670
#> 2  0.9519697 0.9268446 1.624580      0.03133999    0.03210639  2.797863
#> 3  0.9970469 0.9970097 2.026603      0.03439748    0.04536699  6.280112
#> 4  1.0131649 0.9639471 1.702418      0.03276535    0.03609214  3.605621
#> 5  0.9747426 0.9622593 1.672917      0.03259019    0.03416647  3.040846
#> 6  1.0068025 1.0550962 2.316933      0.03668335    0.05246657  7.889020
#> 7  0.9582877 0.9409593 1.998839      0.03236152    0.04120082  5.666845
#> 8  1.0636858 1.0498080 1.865887      0.03593399    0.04326234  4.790975
#> 9  1.0529362 1.1242614 2.331727      0.03913300    0.05661630  8.141976
#> 10 1.0313465 0.9896316 1.618757      0.03346307    0.03428182  2.797992