powered by
This function is called within the third filter, and used to calculate a rolling standard deviation with a window including the 2 leading values.
rolling_sd_3(x)
the standard deviation of x, and the two leading values
an indexed position of a value in a vector for which the rolling standard deviation is needed
# 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