Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Replicating SARIMA model with OLS

    Hi,

    I am trying to understand SARIMA models a bit better.

    Data below -


    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input int air float time int t float(lnair month year)
    112      1949   1 4.7184987  1 1949
    118 1949.0834   2  4.770685  2 1949
    132 1949.1666   3  4.882802  3 1949
    129   1949.25   4  4.859812  4 1949
    121 1949.3334   5  4.795791  5 1949
    135 1949.4166   6  4.905275  6 1949
    148    1949.5   7  4.997212  7 1949
    148 1949.5834   8  4.997212  8 1949
    136 1949.6666   9  4.912655  9 1949
    119   1949.75  10  4.779123 10 1949
    104 1949.8334  11  4.644391 11 1949
    118 1949.9166  12  4.770685 12 1949
    115      1950  13  4.744932  1 1950
    126 1950.0834  14  4.836282  2 1950
    141 1950.1666  15   4.94876  3 1950
    135   1950.25  16  4.905275  4 1950
    125 1950.3334  17  4.828314  5 1950
    149 1950.4166  18  5.003946  6 1950
    170    1950.5  19  5.135798  7 1950
    170 1950.5834  20  5.135798  8 1950
    158 1950.6666  21  5.062595  9 1950
    133   1950.75  22  4.890349 10 1950
    114 1950.8334  23 4.7361984 11 1950
    140 1950.9166  24  4.941642 12 1950
    145      1951  25  4.976734  1 1951
    150 1951.0834  26  5.010635  2 1951
    178 1951.1666  27  5.181784  3 1951
    163   1951.25  28   5.09375  4 1951
    172 1951.3334  29  5.147494  5 1951
    178 1951.4166  30  5.181784  6 1951
    199    1951.5  31  5.293305  7 1951
    199 1951.5834  32  5.293305  8 1951
    184 1951.6666  33  5.214936  9 1951
    162   1951.75  34  5.087596 10 1951
    146 1951.8334  35  4.983607 11 1951
    166 1951.9166  36  5.111988 12 1951
    171      1952  37  5.141664  1 1952
    180 1952.0834  38  5.192957  2 1952
    193 1952.1666  39   5.26269  3 1952
    181   1952.25  40  5.198497  4 1952
    183 1952.3334  41  5.209486  5 1952
    218 1952.4166  42  5.384495  6 1952
    230    1952.5  43  5.438079  7 1952
    242 1952.5834  44  5.488938  8 1952
    209 1952.6666  45  5.342334  9 1952
    191   1952.75  46  5.252274 10 1952
    172 1952.8334  47  5.147494 11 1952
    194 1952.9166  48  5.267858 12 1952
    196      1953  49  5.278115  1 1953
    196 1953.0834  50  5.278115  2 1953
    236 1953.1666  51  5.463832  3 1953
    235   1953.25  52  5.459586  4 1953
    229 1953.3334  53  5.433722  5 1953
    243 1953.4166  54  5.493062  6 1953
    264    1953.5  55  5.575949  7 1953
    272 1953.5834  56  5.605802  8 1953
    237 1953.6666  57   5.46806  9 1953
    211   1953.75  58  5.351858 10 1953
    180 1953.8334  59  5.192957 11 1953
    201 1953.9166  60  5.303305 12 1953
    204      1954  61   5.31812  1 1954
    188 1954.0834  62  5.236442  2 1954
    235 1954.1666  63  5.459586  3 1954
    227   1954.25  64   5.42495  4 1954
    234 1954.3334  65  5.455321  5 1954
    264 1954.4166  66  5.575949  6 1954
    302    1954.5  67  5.710427  7 1954
    293 1954.5834  68  5.680172  8 1954
    259 1954.6666  69  5.556828  9 1954
    229   1954.75  70  5.433722 10 1954
    203 1954.8334  71  5.313206 11 1954
    229 1954.9166  72  5.433722 12 1954
    242      1955  73  5.488938  1 1955
    233 1955.0834  74  5.451038  2 1955
    267 1955.1666  75  5.587249  3 1955
    269   1955.25  76  5.594711  4 1955
    270 1955.3334  77  5.598422  5 1955
    315 1955.4166  78  5.752573  6 1955
    364    1955.5  79  5.897154  7 1955
    347 1955.5834  80  5.849325  8 1955
    312 1955.6666  81  5.743003  9 1955
    274   1955.75  82  5.613128 10 1955
    237 1955.8334  83   5.46806 11 1955
    278 1955.9166  84  5.627621 12 1955
    284      1956  85  5.648974  1 1956
    277 1956.0834  86  5.624018  2 1956
    317 1956.1666  87  5.758902  3 1956
    313   1956.25  88  5.746203  4 1956
    318 1956.3334  89  5.762052  5 1956
    374 1956.4166  90  5.924256  6 1956
    413    1956.5  91  6.023448  7 1956
    405 1956.5834  92  6.003887  8 1956
    355 1956.6666  93  5.872118  9 1956
    306   1956.75  94  5.723585 10 1956
    271 1956.8334  95  5.602119 11 1956
    306 1956.9166  96  5.723585 12 1956
    315      1957  97  5.752573  1 1957
    301 1957.0834  98   5.70711  2 1957
    356 1957.1666  99  5.874931  3 1957
    348   1957.25 100  5.852202  4 1957
    end

    Assuming no MA term (for simplicity), I know we can replicate the output of the SARIMA commands with OLS commands.

    Code:
    //SARIMA
    *  arima(#p,#d,#q)                 specify ARIMA(p,d,q) model for dependent variable
    *  sarima(#P,#D,#Q,#s)         specify period-#s multiplicative seasonal ARIMA term
     arima       lnair,     arima(2,1,0)                 sarima(0,0,0,12)
    
    //OLS
    reg         D.lnair L1.D.lnair     L2.D.lnair         i.year

    However, when I add AR1 term in SARIMA as well (#P argument), can we match the output with an OLS specification as well?

    Code:
    //SARIMA
     
    arima       lnair,     arima(2,1,0)                 sarima(1,0,0,12)
    
    //OLS ???
    I am not sure how to match the output, and would appreciate any help here.
    Last edited by Arvind Sharma; 02 Nov 2023, 15:31.
Working...
X