Displaying 1 result from an estimated 1 matches for "ma14".
Did you mean:
a14
2011 Apr 04
1
moving mean and moving variance functions
...verage.
ma <- function(x , n) {
filter(x, rep(1/n, n), sides = 1)
} # note that when the function is used, n is defined for the
temporal period (7, 14, and 28), and x is the input variable.
ma7 <- ma(dat, 7) # where dat is accessing the foraging potential of the
birds.
ma14 <- ma(dat, 14)
ma28 <- ma(dat, 28)
This works fine. What I don't have is the code for a moving variance.
filter in the function above is included in the stats package and conducts a
linear filtering on a Time Series.
Is there comparable code some place in R for a moving variance?
Tha...