I have a dataset of 4948 daily return from 2000 to 2019 (4948 records)
The relevant variables are the yield and the position (1,2,3,...)
I want to calculate the exponentially weighted moving average chart (EWMA) with R.
There is a function in the package qcc that do it:
ewma(data, sizes, center, std.dev, lambda = 0.2, nsigmas = 3,
data.name, labels, newdata, newsizes, newlabels,
plot = TRUE, ...)
The problem is that I can't decipher some of their arguments:
- data: the dataframe, matrix or vector. (O.K.)
- sizes: we need to suppose there are 4948 groups (one for each day) of a size of one each?
- center: this is the media of each group or the media of the all observations?
- lambda: the parameter to weight each observation in the way the latest are of more weight. (O.K.)
- nsigmas: is this the standard deviation of all the observations or a arbitrary number?
Also, if the relevant variables are the position (1,2,3,..) and the yield how can I put the ticks in x axis as the years (2000,2001,2002,...)