Hello list, we are beginners in R and we are trying to fit the following time series:
*> x <- c(1.89, 2.46, 3.23, 3.95, 4.56, 5.07, 5.62, 6.16, 6.26, 6.56, 6.98, 7.36, 7.53, 7.84, 8.09)* The reason for choosing the present time series is that the we have previously calculated analytically the autoregressive coefficients using the direct inversion method as *1.1, 0.765, 0.1173*. Since those coefficients fits well our time series, we wanted to learn how to do it in R and check that it would give us the same autoregressive coefficients as the direct inversion method. So as first step in R we have initially applied the OLS method and obtained the following autoregression coefficients: *> ar(x, method="ols", order.max=2, demean=FALSE, intercept=TRUE)* *Call:**ar(x = x, order.max = 2, method = "ols", demean = FALSE, intercept = TRUE)* *Coefficients:* *1 2 **0.8049 0.0834 * *Intercept: 1.103 (0.2321) * *Order selected 2 sigma^2 estimated as 0.009756* Those are very close to the ones obtained with the direct inversion method so the fitting is good. Then we tried to apply the other techniques available in R, namely Yule/Walker, Burg, MLE, obtaining different coefficients, which do not give a good fit of the series at all. *> ar(x, method="yw", order.max=2, demean=FALSE, intercept=TRUE)* *Call:**ar(x = x, order.max = 2, method = "yw", demean = FALSE, intercept = TRUE)* *Coefficients:* *1 **0.9305 * *Order selected 1 sigma^2 estimated as 5.368* Please can anybody help us telling how to get a reasonable good fit with YW, Burg and MLE, reporting also the code that needs to be used and commenting the coefficients obtained by comparing those with the ones obtained with OLS. Thanks in advance. Fabio [[alternative HTML version deleted]] ______________________________________________ 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.