[R] ARMA
Pete Brecknock
Peter.Brecknock at bp.com
Mon May 9 00:27:44 CEST 2011
boki2b wrote:
>
> Hello,Could somebody tell me what is the difference between theese 3
> calls of functionsarma(x,order=c(1,0)), arima(x,order=c(1,0,0))
> ar(x,order=1)?I expected same residuals of theese three models,but
> unexpectably for the first two R requiredinitial value of something
> (what?)...Thanks in advance!
> [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at 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.
>
Firstly, all of the functions you mention can be explored in more detail by
typing ?xxx, where xxx is ar, arima or arma. Note, you will need the tseries
package to run the arma function. (require(tseries))
Secondly, there is some debate around interpretation of some of the output
from these functions. Check out one viewpoint at
http://www.stat.pitt.edu/stoffer/tsa2/Rissues.htm (ISSUE 1: When is the
intercept the mean?)
Finally, I have tried below to put the functions on a similar footing to
allow you to compare their output.
# create data
set.seed(12345)
d = rnorm(30)
library(tseries) # need for arma function
# 1. arma
# fits using conditional least squares, "intercept" is the "intercept"
arma(d,order=c(1,0))
> ar1 intercept
> -0.10566 0.07046
# 2. arima
# "intercept" is the "mean", intercept derived as mean*(1-AR1)
arima(d,order=c(1,0,0),method="CSS")
> ar1 intercept
> -0.1057 0.0638
So, intercept = 0.0638 * (1 + 0.1057) = 0.0705 ... same as arma above
# 3. ar
"intercept" is the "intercept"
ar(d,aic=FALSE, order.max=1,method="ols",intercept=TRUE, demean=FALSE)
> 1
> -0.1057
> Intercept: -0.07054 (0.1731)
There is a nice document on CRAN that you may find useful.
http://cran.r-project.org/doc/contrib/Ricci-refcard-ts.pdf
HTH
Pete
--
View this message in context: http://r.789695.n4.nabble.com/ARMA-tp3507846p3507963.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list