Learn R Programming

filteRjsats (version 1.0)

rolling_sd_3: Calculate Standard Deviation Over a Rolling Window of 3

Description

This function is called within the third filter, and used to calculate a rolling standard deviation with a window including the 2 leading values.

Usage

rolling_sd_3(x)

Value

the standard deviation of x, and the two leading values

Arguments

x

an indexed position of a value in a vector for which the rolling standard deviation is needed

Examples

Run this code
# Calculate rolling Standard Deviation
set.seed(1234)
x <- rnorm(n = 100, mean = 10, sd = 1)
rolling_sd_3(x)

Run the code above in your browser using DataLab