demean
Temporal demean of time series data
Syntax
Y = demean(X,normalise)
Arguments
See also Common variable names and data structures.
input
X multi-trial time series data normalise normalise (temporal) variance of each variable to 1 (default: false)
output
Y demeaned time series data
Description
Temporally demean time series data X, which may be single- or multi-trial. If the normalise flag is set, data is normalised so that the (temporal) variance of each series is 1.
Note: For multi-trial data we don't demean on a "per-trial" basis, since this really doesn't make sense... trials in multi-trial data are assumed to be multiple realisations of the same process. In particular, demeaning trials separately can introduce large bias in VAR model estimation (cf. tsdata_to_var). The mean calculated here is thus the temporal mean of ensemble means. If you feel you absolutely have to demean per-trial, then call this function for each trial series X(:,:,r) and then call it with X.