tsl_stats: Summary Statistics of Time Series Lists

View source: R/tsl_stats.R

tsl_statsR Documentation

Summary Statistics of Time Series Lists

Description

This function computes a variety of summary statistics for each time series and numeric column within a time series list. The statistics include common metrics such as minimum, maximum, quartiles, mean, standard deviation, range, interquartile range, skewness, kurtosis, and autocorrelation for specified lags.

For irregular time series, autocorrelation computation is performed after regularizing the time series via interpolation with zoo_resample(). This regularization does not affect the computation of all other stats.

This function supports a parallelization setup via future::plan(), and progress bars provided by the package progressr.

Usage

tsl_stats(tsl = NULL, lags = 1L)

Arguments

tsl

(required, list) Time series list. Default: NULL

lags

(optional, integer) An integer specifying the number of autocorrelation lags to compute. If NULL, autocorrelation computation is disabled. Default: 1.

Value

data frame:

  • name: name of the zoo object.

  • rows: rows of the zoo object.

  • columns: columns of the zoo object.

  • time_units: time units of the zoo time series (see zoo_time()).

  • time_begin: beginning time of the time series.

  • time_end: end time of the time series.

  • time_length: total length of the time series, expressed in time units.

  • time_resolution: average distance between consecutive observations

  • variable: name of the variable, a column of the zoo object.

  • min: minimum value of the zoo column.

  • q1: first quartile (25th percentile).

  • median: 50th percentile.

  • q3: third quartile (75th percentile).

  • max: maximum value.

  • mean: average value.

  • sd: standard deviation.

  • range: range of the variable, computed as max - min.

  • iq_range: interquartile range of the variable, computed as q3 - q1.

  • skewness: asymmetry of the variable distribution.

  • kurtosis:"tailedness" of the variable distribution.

  • ac_lag_1, ac_lag_2, ...: autocorrelation values for the specified lags.

See Also

Other tsl_processing: tsl_aggregate(), tsl_resample(), tsl_smooth(), tsl_transform()

Examples



#three time series
#climate and ndvi in Fagus sylvatica stands in Spain, Germany, and Sweden
tsl <- tsl_initialize(
  x = fagus_dynamics,
  name_column = "name",
  time_column = "time"
)


#stats computation
df <- tsl_stats(
  tsl = tsl,
  lags = 3
  )

df

distantia documentation built on April 4, 2025, 5:42 a.m.