# 2/27 quasi.period=114/11.5 arima(log(lynx),order=c(2,0,0)) quasi.period library(TSA) data(lynx) plot(log(lynx)) ?polyroot # 1-phi1*x-phi2*x^2 phi1=1.38;phi2=-0.74 # ? is it quasi-periodic phi1^2+4*phi2 # is is negative so quasi-periodic theta=acos(phi1/(2*sqrt(-phi2))) theta quasi.period=2*pi/theta R=sqrt(-phi2) R quasi.period z=c(1,-phi1,-phi2) roots=polyroot(z) roots Mod(roots) # magnitude # stationary AR(2) 1/roots Mod(1/roots) # R # all magnitude of the roots >1, so stationarity Arg(1/roots) # -theta and theta ar(log(lynx)) # tells the AR order, based AIC roots=polyroot(c(1,-arima(log(lynx),order=c(11,0,0))$coef)[-12]) roots Mod(roots) # Bad, because the magnitude are less than 1 roots=polyroot(c(1,-arima(log(lynx),order=c(3,0,0))$coef[-4])) roots Mod(1/roots) Arg(1/roots) # Once all roots have magnitude > 1, then the process is stationary. # Then, look at the reciprocol of the roots. If some of them are complex # we have quasiperiodicity. # The pair of (reciprocols of) roots having the largest magnitude is the # dominating pair. The Arg of this pair of (reciprocol) of roots is the theta. # Quais-period=2*pi/theta. plot(y=c(1,ARMAtoMA(ar=c(phi1,phi2),lag.max=100)), x=0:100,type='h') abline(h=0) Mod(roots) abs(phi2) #?<1 phi2+phi1 #?<1 phi2-phi1 #?<1