Calculates the centered moving standard deviation of a series.
MOVSTD(series, N, dof, "naflag", "edgeflag")
series |
- |
A series or array, the input series |
||||||
N |
- |
An integer, the number of points to compute the variance as the series is processed. |
||||||
dof |
- |
Optional. An integer, the degrees of freedom normalization mode.
|
||||||
"naflag" |
- |
Optional. A string, the NA handling method.
|
||||||
"edgeflag" |
- |
Optional. A string, the edge processing flag.
|
A series or table.
W1: {4, 3, 2, 1, 2, 3, 4}
W2: movstd(w1, 3)
W3: movstdev(w1, 3)
W2 == {0.7071, 1, 1, 0.5774, 1, 1, 0.7071}
W3 == {0, 0.7071, 1, 1, 0.5774, 1, 1, 0.7071, 0}
W2 computes a 3-point centered moving sample standard deviation where the result at point N is the sample standard deviation of points N-1, N and N+1. The computation starts at sample 2.
W3 computes a 3-point non-centered moving sample standard deviation.
W1: {4, 3, 2, 1, 2, 3, 4}
W2: movstd(w1, 3, 1)
W3: movstdev(w1, 3, 1, 1)
W2 == {0.5, 0.8165, 0.8165, 0.4714, 0.8165, 0.8165, 0.5}
W3 == {nan, 0.5, 0.8165, 0.8165, 0.4714, 0.8165, 0.8165, 0.5, nan}
Same as above except the population standard deviation is computed.
W1: {4, 3, 2, nan, 2, 3, 4}
W2: movstd(w1, 3)
W3: movstd(w1, 3, "omitnan")
W2 == {0.7071, 1, nan, nan, nan, 1, 0.7071}
W3 == {0.7071, 1, 0.7071, 0, 0.7071, 1, 0.7071}
W2 retains NaN values and returns NaN if any NaN is present in the segment.
W3 excludes all NaN values by removing them from the segment and adjusting the segment size and segment divisor down.
W1: {4, 3, 2, nan, 2, 3, 4}
W2: movstd(w1, 3, 1)
W3: movstd(w1, 3, 1, "omitnan")
W2 == {0.5, 0.8165, nan, nan, nan, 0.8165, 0.5}
W3 == {0.5, 0.8165, 0.5, 0, 0.5, 0.8165, 0.5}
Same as above except the population standard deviation is computed.
W1: {4, 3, 2, 1, 2, 3, 4}
W2: movstd(w1, 3, "discard")
W3: movstd(w1, 3, 1, "discard")
W2 == {1, 1, 0.5774, 1, 1}
W3 == {0.8165, 0.8165, 0.4714, 0.8165, 0.8165}
W2 and W3 compute a 3-point moving standard deviation for all overlapping segments that contain exactly 3 samples. Shorter segments at the start and end edges are discarded.
W2 computes the sample standard deviation and W3 computes population standard deviation.
W1: {4, 3, 2, 1, 2, 3, 4}
W2: movstd(w1, 3)
W3: movstd(w1, 3, "shrink")
W2 == {0.7071, 1, 1, 0.5774, 1, 1, 0.7071}
W3 == {0.7071, 1, 1, 0.5774, 1, 1, 0.7071}
Since the default for edgeflag is "shrink", the results are identical.
MOVSTD computes a centered moving standard deviation by centering the
result within the
For each section of length N, the
sample standard deviation value (
where the arithmetic mean is defined as:
The population standard deviation
NaN values are included by default. Set naflag to "omitnan" to ignore NaN values.
For edgeflag == "discard", only segments that contain exactly N samples are processed. Shorter segments at the start and end edges are discarded.
See MOVSTDEV to compute a non-centered moving standard deviation.
See XMOVSTD to compute the centered moving standard deviation given a duration.