Hi,

I'm trying to calculate the residuals in a one-sided AR(p) model:
sum (phi_j (X_t-j - EX)) = epsilon

My X is an ARMA(1,1)-model, which can be represented as an AR(infty) model.
I calculate the order of the model with AIC and the parameters with the
Yule-Walker method.

For the residuals, I tried:

for (k in (p+1):n){ 
     for (j in 1:p){
          eps[k] <- sum(phi[j] * (X[k-j] - mean(X)))
     }
     ceps[k] <- eps[k] - sum(eps)/(n-p+1) #centering the residuals
}


The residuals in my ARMA(1,1)-models are t-distributed with 6 degrees of
freedom.
Unfortunately my code results in residuals, which are all around zero. So
ecdf(eps) or ecdf(ceps) are very different from a t(6)-distribution.

Where's the bug in my code?

Regards,
Martin
-- 
View this message in context: 
http://www.nabble.com/Problem-with-calculating-the-residuals-in-an-AR%28p%29-model-tp22055764p22055764.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to