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.9995932 1.0149492 2.189996  7.361487    0.04910584      0.03520124
#> 2  0.9540890 0.9201174 1.585627  2.643641    0.03135712      0.03107987
#> 3  0.9980144 0.9979156 2.020478  6.243391    0.04530744      0.03442236
#> 4  1.0114649 0.9645428 1.703108  3.602452    0.03610424      0.03278495
#> 5  0.9753642 0.9624584 1.673127  3.036774    0.03415974      0.03259606
#> 6  1.0063036 1.0566728 2.312000  7.835825    0.05240348      0.03672921
#> 7  0.9588076 0.9443360 1.985021  5.565812    0.04107540      0.03246036
#> 8  1.0644205 1.0493831 1.865895  4.795969    0.04326072      0.03592046
#> 9  1.0545010 1.1236405 2.329021  8.144608    0.05659237      0.03911185
#> 10 1.0302886 0.9924727 1.619795  2.774872    0.03429734      0.03355390