Introduction
This example estimates and predicts an AR(2) model in GAUSS using simulated data. It demonstrates usage of arimaFit
, arimaPredict
and simarmamt
.
Simulate Data
The GAUSS function simarmamt
allows users to randomly generate ARMA data based on user-input data characteristics. This example simulates a series using the data generation process given by
$$z_{t} = 0.3z_{t-1} + \epsilon_{t}$$
new;
library tsmt;
// Simulate arima data
seed = 423458;
y = simarmamt(.3, 1, 0, 2, 0, 250, 1, .5, seed);
// Integrate the series
z = cumsumc(y);
Estimate the Model
This example estimates the parameters of an AR(2) model from the simulated data using the GAUSS arimaFit
procedure.
// Initialize arimaOut structure
struct arimamtOut amo;
// Set AR order
p = 1;
// Run with differencing
d = 1;
// Run arima estimation
amo = arimaFit(z, p, d);
Estimation Output
The output from the model estimation reads:
Final Results: Log Likelihood: 934.057412 Number of Residuals: 249
AIC : -1866.114824 Error Variance : 1.158524598
SBC : -1862.597371 Standard Error : 1.076347805
DF: 248 SSE: 287.314100182
Coefficients Std. Err. T-Ratio Approx. Prob. AR[1,1] 0.32317 0.06046 5.34534 0.00000
Constant: 1.24951510 Total Computation Time: 0.59 (seconds) AR Roots and Moduli: Real : 3.09431 Imag.: 0.00000 Mod. : 3.09431
Predict Model
The final step is to predict the model using arimaPredict
// Forecast 25 periods
f = arimaPredict(amo, z, 25);
Prediction Output
The output from this final step reads:
Forecasts for ARIMA(1,1,0) Model. 95% Confidence Interval Computed. Period LCL Forecasts UCL Forecast Std. Err. 251 459.825730 461.939599 464.053468 1.078524 252 459.553388 463.059347 466.565305 1.788787 253 459.641039 464.266924 468.892810 2.360189 254 459.940368 465.502886 471.065404 2.838072 255 460.374059 466.748021 473.121984 3.252081 256 460.899670 467.996121 475.092572 3.620705 257 461.492316 469.245178 476.998041 3.955615 258 462.136376 470.494546 478.852715 4.264451 259 462.821419 471.744013 480.666607 4.552428 260 463.540107 472.993513 482.446918 4.823255 261 464.287058 474.243023 484.198987 5.079667 262 465.058187 475.492536 485.926886 5.323746 263 465.850307 476.742051 487.633794 5.557114 264 466.660877 477.991566 489.322255 5.781070 265 467.487828 479.241081 490.994333 5.996668 266 468.329454 480.490596 492.651738 6.204779 267 469.184323 481.740111 494.295899 6.406132 268 470.051224 482.989626 495.928028 6.601347 269 470.929119 484.239141 497.549163 6.790953 270 471.817112 485.488656 499.160201 6.975406 271 472.714421 486.738171 500.761921 7.155106 272 473.620362 487.987686 502.355011 7.330402 273 474.534330 489.237202 503.940073 7.501603 274 475.455786 490.486717 505.517647 7.668983 275 476.384251 491.736232 507.088213 7.832788