Confidence intervals
Arguments
- x
input time series.
- coef
moving-average (
moving_average()
) or finite filter (finite_filters()
) used to filter the series.- coef_var
moving-average (
moving_average()
) or finite filter (finite_filters()
) used compute the variance (throwvar_estimator()
). By default equal tocoef
.- level
confidence level.
- ...
other arguments passed to the function
moving_average()
to convertcoef
to a"moving_average"
object.
Details
Let \((\theta_i)_{-p\leq i \leq q}\) be a moving average of length \(p+q+1\) used to filter a time series \((y_i)_{1\leq i \leq n}\). Let denote \(\hat{\mu}_t\) the filtered series computed at time \(t\) as: $$ \hat{\mu}_t = \sum_{i=-p}^q \theta_i y_{t+i}. $$ If \(\hat{\mu}_t\) is unbiased, a approximate confidence for the true mean is: $$ \left[\hat{\mu}_t - z_{1-\alpha/2} \hat{\sigma} \sqrt{\sum_{i=-p}^q\theta_i^2}; \hat{\mu}_t + z_{1-\alpha/2} \hat{\sigma} \sqrt{\sum_{i=-p}^q\theta_i^2} \right], $$ where \(z_{1-\alpha/2}\) is the quantile \(1-\alpha/2\) of the standard normal distribution.
The estimate of the variance \(\hat{\sigma}\) is obtained using var_estimator()
with the parameter coef_var
.
The assumption that \(\hat{\mu}_t\) is unbiased is rarely exactly true, so variance estimates and confidence intervals are usually computed at small bandwidths where bias is small.
When coef
(or coef_var
) is a finite filter, the last points of the confidence interval are
computed using the corresponding asymmetric filters