Spread {s2dv}R Documentation

Compute interquartile range, maximum-minimum, standard deviation and median absolute deviation

Description

Compute interquartile range, maximum-minimum, standard deviation and median absolute deviation along the list of dimensions provided by the compute_dim argument (typically along the ensemble member and start date dimension). The confidence interval is computed by bootstrapping by 100 times. The input data can be the output of Load(), Ano(), or Ano_CrossValid(), for example.

Usage

Spread(
  data,
  compute_dim = "member",
  na.rm = TRUE,
  conf = TRUE,
  alpha = 0.05,
  ncores = NULL
)

Arguments

data

A numeric vector or array with named dimensions to compute the statistics. The dimensions should at least include 'compute_dim'.

compute_dim

A vector of character strings of the dimension names along which to compute the statistics. The default value is 'member'.

na.rm

A logical value indicating if NAs should be removed (TRUE) or kept (FALSE) for computation. The default value is TRUE.

conf

A logical value indicating whether to compute the confidence intervals or not. The default value is TRUE.

alpha

A numeric of the significance level to be used in the statistical significance test. The default value is 0.05.

ncores

An integer indicating the number of cores to use for parallel computation. The default value is NULL.

Value

A list of numeric arrays with the same dimensions as 'data' but without 'compute_dim' and with the first dimension 'stats'. If 'conf' is TRUE, the length of 'stats' is 3 corresponding to the lower limit of the confidence interval, the spread, and the upper limit of the confidence interval. If 'conf' is FALSE, the length of 'stats' is 1 corresponding to the spread.

$iqr

InterQuartile Range.

$maxmin

Maximum - Minimum.

$sd

Standard Deviation.

$mad

Median Absolute Deviation.

Examples

# Load sample data as in Load() example:
example(Load)
clim <- Clim(sampleData$mod, sampleData$obs)
ano_exp <- Ano(sampleData$mod, clim$clim_exp)
runmean_months <- 12
smooth_ano_exp <- Smoothing(ano_exp, runmeanlen = runmean_months)
smooth_ano_exp_m_sub <- smooth_ano_exp - InsertDim(MeanDims(smooth_ano_exp, 'member', 
                                                           na.rm = TRUE), 
                                                  posdim = 3, 
                                                  lendim = dim(smooth_ano_exp)['member'], 
                                                  name = 'member')
suppressWarnings({
spread <- Spread(smooth_ano_exp_m_sub, compute_dim = c('member', 'sdate'))
})

## Not run: 
PlotVsLTime(Reorder(spread$iqr, c('dataset', 'stats', 'ftime')), 
           toptitle = "Inter-Quartile Range between ensemble members",
           ytitle = "K", monini = 11, limits = NULL, 
           listexp = c('CMIP5 IC3'), listobs = c('ERSST'), biglab = FALSE, 
           hlines = c(0))
PlotVsLTime(Reorder(spread$maxmin, c('dataset', 'stats', 'ftime')), 
           toptitle = "Maximum minus minimum of the members", 
           ytitle = "K", monini = 11, limits = NULL, 
           listexp = c('CMIP5 IC3'), listobs = c('ERSST'), biglab = FALSE, 
           hlines = c(0))
PlotVsLTime(Reorder(spread$sd, c('dataset', 'stats', 'ftime')), 
           toptitle = "Standard deviation of the members", 
           ytitle = "K", monini = 11, limits = NULL, 
           listexp = c('CMIP5 IC3'), listobs = c('ERSST'), biglab = FALSE, 
           hlines = c(0))
PlotVsLTime(Reorder(spread$mad, c('dataset', 'stats', 'ftime')), 
           toptitle = "Median Absolute Deviation of the members",
           ytitle = "K", monini = 11, limits = NULL, 
           listexp = c('CMIP5 IC3'), listobs = c('ERSST'), biglab = FALSE, 
           hlines = c(0))

## End(Not run)


[Package s2dv version 2.0.0 Index]