XMOVSTDEV

Purpose:

Calculates the moving standard deviation of a series given a duration.

Syntax:

XMOVSTDEV(series, xdur, rampflag, dof, "naflag", "edgeflag")

series

-

A series or array, the input series

xdur

-

A real, the X duration used to compute the integer number of samples for the moving interval.

rampflag

-

Optional. An integer, endpoint averaging flag.

0

:

down

1

:

up (default)

dof

-

Optional. An integer, the degrees of freedom normalization mode.

0

:

sample variance, normalize by 1/(N-1) (default)

1

:

population variance, normalize by 1/N

"naflag"

-

Optional. A string, the NA handling method.

"omitnan"

:

ignore NA values (default)

"includenan"

:

include NA values

"edgeflag"

-

Optional. A string, the edge processing flag.

"full"

:

process all segments (default)

"center"

:

center the result within the overlapping N point segments

"discard"

:

ignore partial segments

"shrink"

:

shrink the segment size to actual number of samples at the edge segments (same as rampflag == 1)  

Returns:

A series or table.

Example:

W1: {1, 2, 4, 7};setdeltax(1/100)

W2: movstdev(w1, 3)

W3: xmovstdev(w1, 0.02)

 

W1 contains the input data with a sample rate of 100 Hz.

W2 computes a 3 point moving standard deviation.

W3 computes the same moving standard deviation except the block size is specified in terms of seconds. Since a 0.02 interval equates to 3 samples, both functions return the series:

{0.707, 1.528, 2.517, 2.121}

Example:

W1: integ(gnorm(10000, 1/10000)) * 1000

W2: movstdev(w1, 51)

W3: xmovstdev(w1, 0.005)

W4: W2 - W3

 

W1 synthesizes 10000 samples of data with a sample rate of 10kHz.

W2 computes a 51 point moving standard deviation.

W3 computes a moving standard deviation with a moving interval of 0.005 seconds. Since a 0.005 interval equates to 51 samples, the two moving standard deviation results are identical.

Remarks:

The interval duration xdur is converted to the integer sample interval N with:

 

N = xdur / deltax(s) + 1

 

where xdur >= deltax(s)

 

NaN values are ignored by default. Set naflag to "includenan" to process NaN values.

 

See MOVSTDEV for more details on rampflag, naflag and edgeflag.

 

See XMOVSTD to compute the centered moving standard deviation given a duration.

See Also:

MOVAVG

MOVRMS

MOVSTD

MOVSTDEV

MOVVAR

STD

STDEV

XMOVSTD