set verbose off clear scalar T = 500 nulldata T --preserve setobs 1 1 --special-time-series series ut = normal(0,1) # Gaussian white noise scalar m = 10 # Επιλέξτε αναμενόμενη τιμή μ για την yt scalar phi1 = 0.8 # φ = -1.01, -1, -0.999, -0.9 , -0.8, .... 0 ,..., 0.8, 0.9, 0.999, 1, 1.01 scalar a = m*(1-phi1) # Η σταθερά στο AR(1) είναι μ*(1-φ) smpl 1 1 series yt = m # Αρχική τιμή της yt, y(1) = μ setinfo yt --graph-name="y(t) = α + φ*y(t-1) + u(t)" smpl 2 T yt = a + phi1*yt(-1) + ut smpl full string gtitle = sprintf("α=%4.2f και φ=%4.2f", a, phi1) gnuplot yt --time-series --with-lines --output=display { set title "@gtitle"; } /* ==================== Correlogram ==================== In a nutshell: If the ACF plot declines gradually and the PACF drops instantly, use Auto Regressive model. If the ACF plot drops instantly and the PACF declines gradually, use Moving Average model. If both ACF and PACF decline gradually, combine Auto Regressive and Moving Average models (ARMA). If both ACF and PACF drop instantly (no significant lags), it’s likely you won’t be able to model the time series. */ corrgm yt 12 --plot=display # compute PACF. Compare autoregressive coefficients with PACF estimates (first 6 estimates) ols yt 0 yt(-1) ols yt 0 yt(-1 to -2) ols yt 0 yt(-1 to -3) ols yt 0 yt(-1 to -4) ols yt 0 yt(-1 to -5) ols yt 0 yt(-1 to -6)