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.0108903 0.9649274 1.702008  3.596846    0.03610056      0.03279688
#> 2  0.9751009 0.9626591 1.672421  3.034074    0.03415770      0.03260228
#> 3  1.0063036 1.0566728 2.312000  7.835825    0.05240348      0.03672921
#> 4  0.9588076 0.9443360 1.985021  5.565812    0.04107540      0.03246036
#> 5  1.0644205 1.0493831 1.865895  4.795969    0.04326072      0.03592046
#> 6  1.0545010 1.1236405 2.329021  8.144608    0.05659237      0.03911185
#> 7  1.0302886 0.9924727 1.619795  2.774872    0.03429734      0.03355390
#> 8  1.0029053 1.0172244 2.178827  7.268681    0.04897141      0.03526468
#> 9  0.9535002 0.9200231 1.587923  2.649969    0.03137525      0.03107803
#> 10 0.9989811 0.9978925 2.017936  6.236392    0.04528715      0.03442034