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  0.9973735 0.9967847 2.027467  6.285380    0.04537118      0.03439063
#> 2  1.0132720 0.9639491 1.702073  3.604808    0.03608960      0.03276525
#> 3  0.9733775 0.9625180 1.674963  3.044439    0.03418782      0.03259972
#> 4  1.0068927 1.0551332 2.316476  7.886724    0.05246231      0.03668425
#> 5  0.9584722 0.9408649 1.999007  5.668644    0.04120152      0.03235857
#> 6  1.0625965 1.0501995 1.866235  4.787704    0.04326805      0.03594674
#> 7  1.0528953 1.1242920 2.331585  8.141165    0.05661557      0.03913392
#> 8  1.0294244 0.9895526 1.623136  2.812150    0.03432960      0.03346359
#> 9  1.0010880 1.0156789 2.180656  7.320498    0.04903347      0.03521974
#> 10 0.9519697 0.9268446 1.624580  2.797863    0.03210639      0.03133999