Further to viewtopic.php?f=4&t=3566 attached is a procedure for calculating roots of the characteristic polynomial and inverse roots of the characteristic polynomial for ARIMA models.
has 13 AR roots = 1 AR root + 12 seasonal AR roots, but there are only 2 coeffs + the constant? And it doesn't appear to be estimating a separate AR(1) and then a separate AR(12) and putting both the characteristic roots plots 'together', or easier in separate plots!
Further, from p.346, Forecasting Methods,3e, by Makridakis, Wheelwright, and Hyndman (1998, Wiley), specification ARIMA(1,1,1)*(1,1,1)[4], quarterly data, it's simple to multiply out the factors, but the general model has 8 AR terms at lags 1,2,4,5,6,8,9 and 10 (implying 8 roots) and 3 MA lagged terms at 1,4,5 (implying 3 roots). Accordingly, shouldn't ARIMA(1,1,1)*(1,1,1)[4] have 5 AR roots and 5 MA roots?
has 13 AR roots = 1 AR root + 12 seasonal AR roots, but there are only 2 coeffs + the constant? And it doesn't appear to be estimating a separate AR(1) and then a separate AR(12) and putting both the characteristic roots plots 'together', or easier in separate plots!
Further, from p.346, Forecasting Methods,3e, by Makridakis, Wheelwright, and Hyndman (1998, Wiley), specification ARIMA(1,1,1)*(1,1,1)[4], quarterly data, it's simple to multiply out the factors, but the general model has 8 AR terms at lags 1,2,4,5,6,8,9 and 10 (implying 8 roots) and 3 MA lagged terms at 1,4,5 (implying 3 roots). Accordingly, shouldn't ARIMA(1,1,1)*(1,1,1)[4] have 5 AR roots and 5 MA roots?
I'd be grateful for a response.
Cheers,
Amarjit
That's just wrong. The number of free coefficients has nothing to do with the number of roots. The number of roots (counting multiplicities) is equal to the degree of the polynomial---that's the fundamental theorem of algebra. If you have a multiplicative model, the set of roots of the combined polynomials is the union of the set of roots of one and the roots of the other. (In order for the product to be zero, one of the two factors must be zero). 1-z^4 has *no* estimated parameters but 4 roots (+1, -1, +i, -i).
This uses the polynomial functions to graph the (inverted) roots of the MA polynomial from another of the MWH examples.
*
* Makridakis et al, Forecasting Methods and Applications, 3rd edition
* Example 7/7 on pp 364-365
*
open data writing.dat
calendar(m) 1963
data(format=free,org=columns) 1963:1 1972:12 writing
*
boxjenk(diffs=1,sdiffs=1,ma=1,sma=1,maxl,define=deq) writing
*
set ustd = %resids/sqrt(%seesq)
*
graph(footer="Figure 7-25 Analysis of Residuals")
# ustd
@regcorrs ustd
compute mapoly=%eqnlagpoly(deq,%mvgavge)
compute maroots=%polycxroots(mapoly)
ewise maroots(i)=1.0/maroots(i)
set realz 1 %size(maroots) = %real(maroots(t))
set imagz 1 %size(maroots) = %imag(maroots(t))
scatter
# realz imagz
set unitr 1 1001 = cos(2*%pi*(t-1)/1000)
set unitc 1 1001 = sin(2*%pi*(t-1)/1000)
scatter(style=dots,overlay=line) 2
# realz imagz
# unitr unitc
Note that there are 13 roots, since it's an MA(1) x SMA(1) so degree 13. 12 are equally spaced around a not-quite unit circle as the roots of the SMA, while there is a separate real root for the MA(1).
Also, am I right in thinking the coefficients of ARIMA models are not necessarily restricted to be between -1 and +1, implying a non-explosive model; it's the inverse roots which should be inside the complex unit circle: i.e. if AR roots lie inside the complex unit circle ARIMA model is stationary, and if MA roots lie inside the complex unit circle ARIMA model is invertible?
DEQ is the full model for WRITING, which includes the DIFFS and SDIFFS. It should have 25 distinct roots (+1.0 is duplicated), 12 on the unit circle and 13 inside.
How do I exactly plot the blue complex unit circle? As with the last model I get the following plot, attached.
Then I can write a correct procedure for plotting inverse characteristic roots of ARIMA models, including seasonal.
For model 'stability', to confirm it is 'not wrong' for the coefficients of ARIMA models being outside -1 and +1, implying an explosive model, as in VAR's; it's the inverse roots which should be on or inside the complex unit circle?
A mis-understanding on the previous post, as I didn’t plot the inverse roots and do not know how to display/print the coordinates (i,j) of the complex unit circle -- for the last 5 specifications there are 12 inverse roots which lie on the complex unit circle!
Attached is a procedure ACBJCRS.src for plotting the inverse roots for any ARIMA model; here's an example specification.
boxjenk(const,diffs=1,sdiffs=1,ar=1,sar=1,maxl,define=deq) writing; * 12 inverse roots on the complex unit circle
@ACBJCRS(title='writing') deq writing
Within the ACBJCRS procedure I have used GCONTOUR as in https://estima.com/~estimaco/ratshelp/i ... ction.html to plot the inverse roots; IMHO both the complex unit circles should be next to each other regardless of specification, and they 'size and appear' better than using SCATTER for these plots.
I'd be very grateful if you would check ACBJCRS, and for any improvements e.g. I'd like to color the "AR" and "MA" in GRTEXT (or maybe use another function with x, y coordinates to display the roots, but GRTEXT works fine).
Questions:
1) For this example, I can visually see the 12 inverse roots (1 duplicated) which lie on the complex unit circle using GCONTOUR, and they are in the second half of the table. I have manually emboldened and manually placed a [#] next to the inverse roots which lie on the circle, as they appear anti-clockwise, from horizontal on the RHS.
The modulus can be used to check if the inverse roots exactly lie on the circle or inside or outside. Correct?
2) If the roots lie on the complex unit circle it means DIFFS or SDIFFS has been applied to account for stationarity in the series (unless there's parameters whose roots lie exactly on the circle). What does it mean if the inverse roots exactly lie on the circle with regard to stationarity and invertibility, or otherwise (series and model)?
3) On initial running of ACBJCRS the gridlines on the LHS plot, at 0, both horizontally and vertically do not appear, but they do appear running the procedure for a second time. Why? Similarly as previously with the ACBJCR procedure.
4) An example with all 4 parameters AR, MA, SAR, SMA, and diffs, sdiffs
I'm baffled about what you're trying to do. You *know* how many differences/seasonal differences you've done so you will know exactly how many unit roots you have. The AR parts are forced to be stationary by maximum likelihood. (There is no unconditional likelihood for a non-stationary model).
The MA's are also going to be forced inside or on the unit circle. An MA with a bad root has an equivalent model with the root flipped inside. (That has nothing to do with maximum likelihood). An MA with a unit root is permitted, but in practice would never be estimated since it's a boundary value, and is usually a sign of an overdifferenced model: for instance, if x is white noise, then x=u, so (1-L)x=(1-L)u so first differencing x induces a unit root MA process.
RATS graphs work from the outside in (which is pretty typical) and, by default, take the shape from the device on which they are displayed. If you want to control the dimensions, use the WIDTH and HEIGHT options on the SCATTER or other graphics instruction---probably something like HEIGHT=5.0,WIDTH=5.0 will give you the effect you want. I'm not sure I like the idea of using GRTEXT with BOX and a tiny font rather than SCATTER with DOTS---the box isn't as easy to localize as the dot.
The axis problem on the GCONTOUR appears to be a bug.
ACBJCRS procedure is useful for visualizing the inverse roots and checking the numerical values in the table.
On occasion BOXJENK does not converge using MAXL despite the various METHOD's, therefore I have had to resort to NOMAXL which is not ideal regarding sample size and estimation.
Using GRTEXT I tried TRANSPARENT to exactly view the position of GCONTOUR behind the BOX, but the unit circle is not visible. I am however happy with the plots as they are with GCONTOUR & GRTEXT, but agree SCATTER does a better job pinpointing the dot.
Although, if I use SCATTER I run into problems.
Attached is the SCATTER version of the procedure:
acbjCRS_s.src.
Also attached are plots:
plot1_g.rgf plot2_g.rgf - GCONTOUR & GRTEXT version
plot1_s.rgf plot2_s.rgf - SCATTER version
1. Use OVSAMESCALE on the SCATTER when the two are supposed to use the same scale. (That's why you are getting two axes in the one graph).
2. WIDTH and HEIGHT only apply to the outermost graph command---in your case the SPGRAPH. If you're doing a 2 x 1 graph, you probably want something more like WIDTH=10.0,HEIGHT=5.0 to get panes that are roughly square.
3. If BOXJENK with MAXL fails to estimate successfully, you should probably ignore the model. @BJAUTOFIT will put in the last log likelihood whether the model converges or not, which, if the model has a major issue, will generally be much worse than the better behaved models. Remember that if an ARMA(p,q) model is adequate, an ARMA(p+1,q+1) is unindentified, and unlikely to estimate properly, but it also is clearly dominated by smaller model.
scatter(style=dots,overlay=line,footer="If AR roots lie inside the unit circle ARIMA model is stationary", $
OVSAMESCALE,HMIN=-1.5,HMAX=+1.5,VMIN=-1.5,VMAX=1.5) 2
# arrealz_0 arimagz_0 / 3
# arrealz_1 arimagz_1 / 1
# arrealz_2 arimagz_2 / 4
# unitr unitc
but it's not right.
TomDoan wrote:
3. If BOXJENK with MAXL fails to estimate successfully, you should probably ignore the model. @BJAUTOFIT will put in the last log likelihood whether the model converges or not, which, if the model has a major issue, will generally be much worse than the better behaved models. Remember that if an ARMA(p,q) model is adequate, an ARMA(p+1,q+1) is unindentified, and unlikely to estimate properly, but it also is clearly dominated by smaller model.
I presume the same for @GMAUTOFIT? If I 'ignore the model' then how to feed-in 'the most appropriate/best' chosen specification from the automated sequence
@BJDIFF
@GMAUTOFIT
into BOXJENK always including MAXL (*very* occasionally change METHOD and include dummies with REGRESSORS, and to NOMAXL)?
scatter(style=dots,overlay=line,footer="If AR roots lie inside the unit circle ARIMA model is stationary", $
OVSAMESCALE,HMIN=-1.5,HMAX=+1.5,VMIN=-1.5,VMAX=1.5) 2
# arrealz_0 arimagz_0 / 3
# arrealz_1 arimagz_1 / 1
# arrealz_2 arimagz_2 / 4
# unitr unitc
but it's not right.
Your SCATTER instruction says you're doing two pairs, but you actually have four.
ac_1 wrote:
TomDoan wrote:
3. If BOXJENK with MAXL fails to estimate successfully, you should probably ignore the model. @BJAUTOFIT will put in the last log likelihood whether the model converges or not, which, if the model has a major issue, will generally be much worse than the better behaved models. Remember that if an ARMA(p,q) model is adequate, an ARMA(p+1,q+1) is unindentified, and unlikely to estimate properly, but it also is clearly dominated by smaller model.
I presume the same for @GMAUTOFIT? If I 'ignore the model' then how to feed-in 'the most appropriate/best' chosen specification from the automated sequence
@BJDIFF
@GMAUTOFIT
into BOXJENK always including MAXL (*very* occasionally change METHOD, and to NOMAXL)?
If you're picking the "best" then a non-converging model won't be the best by any criterion.
* Plot inverse characteristic roots
if (FPLOT == 1) {
if %defined(title)
compute ltitle=title
else
compute ltitle="inverse roots of the characteristic polynomial"
spgraph(hfields=2,vfields=1,header=%l(depvar)+"\\"+ltitle,WIDTH=10.0,HEIGHT=5.0)
grparm(bold)
grparm footer 22
if (%size(arroots).ne.0) {
spgraph(hfields=1,vfields=1)
scatter(style=dots,overlay=line,footer="If AR roots lie inside the unit circle ARIMA model is stationary", $
OVSAMESCALE,HMIN=-1.5,HMAX=+1.5,VMIN=-1.5,VMAX=1.5) 2
# arrealz arimagz
# unitr unitc
spgraph(done)
spgraph(hfields=1,vfields=1); * no MA graph
spgraph(done)
}
if (%size(maroots).ne.0) {
spgraph(hfields=1,vfields=1); * no AR graph
spgraph(done)
spgraph(hfields=1,vfields=1)
scatter(style=dots,overlay=line,footer="If MA roots lie inside the unit circle ARIMA model is invertible", $
OVSAMESCALE,HMIN=-1.5,HMAX=+1.5,VMIN=-1.5,VMAX=1.5) 2
# marealz maimagz
# unitr unitc
spgraph(done)
}
spgraph(done)
if (%size(arroots).eq.0).and.(%size(maroots).eq.0) {
disp ''
disp 'NO PLOTS'
disp ''
}
}
if (FPLOT == 0) {
disp ''
disp 'NO PLOTS'
disp ''
}
* Plot inverse characteristic roots
if (FPLOT == 1) {
if %defined(title)
compute ltitle=title
else
compute ltitle="inverse roots of the characteristic polynomial"
@gridseries(from=-1.5,to=1.5,n=150) z1grid
@gridseries(from=-1.5,to=1.5,n=150) z2grid
dec rect f(151,151)
ewise f(i,j) = z1grid(i)^2 + z2grid(j)^2
dec vect contours(1)
ewise contours(i)=1.0*i
disp contours
spgraph(hfields=2,vfields=1,header=%l(depvar)+"\\"+ltitle,WIDTH=10.0,HEIGHT=5.0)
grparm(bold)
grparm footer 22
gcontour(AXIS=BOTH,footer="If AR roots lie inside the unit circle ARMA model is stationary",f=f,x=z2grid,y=z1grid,number=1,contours=contours,$
header="inverse AR roots",Hlabel="Real",Vlabel="Imaginary")
do k = 1, %size(arroots)
grtext(x=arrealz(k),y=arimagz(k),BOLD,BOX,SIZE=5,TRANSPARENT) "AR"
end do k
gcontour(AXIS=BOTH,footer="If MA roots lie inside the unit circle ARMA model is invertible",f=f,x=z2grid,y=z1grid,number=1,contours=contours,$
header="inverse MA roots",HLABEL="Real",VLABEL="Imaginary")
do l = 1, %size(maroots)
grtext(x=marealz(l),y=maimagz(l),BOLD,BOX,SIZE=5,TRANSPARENT) "MA"
end do l
spgraph(done)
if (%size(arroots).eq.0).and.(%size(maroots).eq.0) {
disp ''
disp 'NO PLOTS'
disp ''
}
}
if (FPLOT == 0) {
disp ''
disp 'NO PLOTS'
disp ''
}