standardize (pyleoclim.utils.tsutils.standardize)¶
- pyleoclim.utils.tsutils.standardize(x, scale=1, axis=0, ddof=0, eps=0.001)[source]¶
Centers and normalizes a given time series. Constant or nearly constant time series not rescaled.
- Parameters
x (array) – vector of (real) numbers as a time series, NaNs allowed
scale (real) – A scale factor used to scale a record to a match a given variance
axis (int or None) – axis along which to operate, if None, compute over the whole array
ddof (int) – degress of freedom correction in the calculation of the standard deviation
eps (real) – a threshold to determine if the standard deviation is too close to zero
- Returns
z (array) – The standardized time series (z-score), Z = (X - E[X])/std(X)*scale, NaNs allowed
mu (real) – The mean of the original time series, E[X]
sig (real) – The standard deviation of the original time series, std[X]
References
Tapio Schneider’s MATLAB code: http://www.clidyn.ethz.ch/imputation/standardize.m
The zscore function in SciPy: https://github.com/scipy/scipy/blob/master/scipy/stats/stats.py
See also
pyleoclim.utils.tsutils.preprocess
pre-processes a times series using standardization and detrending.