basically we can extract optimum AR order from auto.arima by
> auto.arima(ret.fin.chn,trace=TRUE,allowdrift=TRUE)
ARIMA(2,0,2) with non-zero mean : -14242.19
ARIMA(0,0,0) with non-zero mean : -14239.24
ARIMA(1,0,0) with non-zero mean : -14241.3
ARIMA(0,0,1) with non-zero mean : -14238.16
ARIMA(1,0,2) with non-zero mean : -14237.65
ARIMA(3,0,2) with non-zero mean : -14242.72
ARIMA(3,0,1) with non-zero mean : -14239.52
ARIMA(3,0,3) with non-zero mean : -14242.5
ARIMA(2,0,1) with non-zero mean : -14237.15
ARIMA(4,0,3) with non-zero mean : -14238.06
ARIMA(3,0,2) with zero mean : -14244.39
ARIMA(2,0,2) with zero mean : -14243.98
ARIMA(4,0,2) with zero mean : -14241.45
ARIMA(3,0,1) with zero mean : -14241.23
ARIMA(3,0,3) with zero mean : -14244.04
ARIMA(2,0,1) with zero mean : -14238.78
ARIMA(4,0,3) with zero mean : -14239.73
Best model: ARIMA(3,0,2) with zero mean
Series: ret.fin.chn
ARIMA(3,0,2) with zero mean
Coefficients:
ar1 ar2 ar3 ma1 ma2
0.5497 -0.4887 0.0461 -0.5691 0.4923
s.e. 0.3525 0.1764 0.0232 0.3534 0.1878
sigma^2 estimated as 0.0003277: log likelihood=7127.67
AIC=-14243.35 AICc=-14243.32 BIC=-14207.83
Warning messages:
1: In if (is.constant(x)) { :
the condition has length > 1 and only the first element will be used
2: In if (is.constant(x)) return(d) :
the condition has length > 1 and only the first element will be used
3: In if (is.constant(dx)) { :
the condition has length > 1 and only the first element will be used
now store the result to object a
> a<-auto.arima(ts(ret.fin.chn),trace=TRUE,allowdrift=TRUE)
then
> a$arma[1]
while for optimum MA order by
> a$arma[2]
now look at this part Best model: ARIMA(3,0,2) with zero mean
this is the ARIMA(p,d,q) order
i've known how to extract the AR(p) and MA(q) order but how to extract the Integration(d) order and note in mind that i've tried the ndiffs
and sometimes it gives different result than the best model perhaps it's somewhere in $arma[?]
???
More generally, the order (d) is the next to last element; the seasonal order (D) is the last. So-
a$arma[length(a$arma)-1]
is the order da$arma[length(a$arma)]
is the seasonal orderAs pointed out by Rob Hyndman, one of the authors of the forecast
package, in an answer to a similar question on Cross Validated, an easy way to extract the order vector (p,d,q)
is to use the forecast::arimaorder
function.
In your example, this would work as follows:
arimaorder(a)
The output is a named integer with the values of p
, d
and q
:
p d q
3 0 2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With