2
$\begingroup$

I would like to estimate the variance of a time series. Say, if the time series has a period of 24, and I want to estimate the variance using

$$ \sigma_t^2 = \frac{1}{2k+1} \sum^k_{-k} (y_{t+24k} - \bar{y}_t)^2 $$

where $\bar{y}_t = \frac{1}{2k+1} \sum^k_{-k} y_{t+24k}$.

I found some posts suggest using roll apply, but it seems to only work when estimating variance using neighbourhood data, which does not take the period into account.

Does anyone which function to use in this case?

$\endgroup$
1
  • 1
    $\begingroup$ Even though the question is phrased in terms of asking for an R function, I believe there is a genuine statistical question here, so I would not close this thread. @Jeannie, be aware that questions focused on software are off topic here, so it is advisable to phrase them in general statistical terms. Also, could you elaborate on it seems to only work when estimating variance using neighbourhood data, which does not take the period into account? $\endgroup$ Aug 1, 2016 at 19:30

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.