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.0543584 1.1241234 2.329325      0.03912704    0.05659110  8.135438
#> 2  1.0293663 0.9896083 1.622876      0.03346532    0.03432897  2.811431
#> 3  1.0010880 1.0156789 2.180656      0.03521974    0.04903347  7.320498
#> 4  0.9519697 0.9268446 1.624580      0.03133999    0.03210639  2.797863
#> 5  0.9970469 0.9970097 2.026603      0.03439748    0.04536699  6.280112
#> 6  1.0131649 0.9639471 1.702418      0.03276535    0.03609214  3.605621
#> 7  0.9747426 0.9622593 1.672917      0.03259019    0.03416647  3.040846
#> 8  1.0068025 1.0550962 2.316933      0.03668335    0.05246657  7.889020
#> 9  0.9582877 0.9409593 1.998839      0.03236152    0.04120082  5.666845
#> 10 1.0636858 1.0498080 1.865887      0.03593399    0.04326234  4.790975