Estimation of ARCH(2) Process
/*--------------------------------------------------------------
SAS Sample Library
Name: autex06.sas
Description: Example program from SAS/ETS User's Guide,
The AUTOREG Procedure
Title: Estimation of ARCH(2) Process
Product: SAS/ETS Software
Keys: autoregression
PROC: AUTOREG
Notes:
--------------------------------------------------------------*/
title 'IBM Stock Returns (daily)';
title2 '29jun1959 - 30jun1960';
data ibm;
infile datalines eof=last;
input x @@;
r = dif( log( x ) );
time = _n_-1;
output;
return;
last:
do i = 1 to 46;
r = .;
time + 1;
output;
end;
return;
datalines;
445 448 450 447 451 453 454 454 459 440 446 443 443 440
439 435 435 436 435 435 435 433 429 428 425 427 425 422
409 407 423 422 417 421 424 414 419 429 426 425 424 425
425 424 425 421 414 410 411 406 406 413 411 410 405 409
410 405 401 401 401 414 419 425 423 411 414 420 412 415
412 412 411 412 409 407 408 415 413 413 410 405 410 412
413 411 411 409 406 407 410 408 408 409 410 409 405 406
405 407 409 407 409 425 425 428 436 442 442 433 435 433
435 429 439 437 439 438 435 433 437 437 444 441 440 441
439 439 438 437 441 442 441 437 427 423 424 428 428 431
425 423 420 426 418 416 419 418 416 419 425 421 422 422
417 420 417 418 419 419 417 419 422 423 422 421 421 419
418 421 420 413 413 408 409 415 415 420 420 424 426 423
423 425 431 436 436 440 436 443 445 439 443 445 450 461
471 467 462 456 464 463 465 464 456 460 458 453 453 449
447 453 450 459 457 453 455 453 450 456 461 463 463 461
465 473 473 475 499 485 491 496 504 504 509 511 524 525
541 531 529 530 531 527 525 519 514 509 505 513 525 519
519 522 522
;
proc sgplot data=ibm;
series y=r x=time/lineattrs=(color=blue);
refline 0/ axis = y LINEATTRS = (pattern=ShortDash);
run;
proc autoreg data=ibm maxit=50;
model r = / noint garch=(q=2);
output out=a cev=v;
run;
data b; set a;
length type $ 8.;
if r ^= . then do;
type = 'ESTIMATE'; output; end;
else do;
type = 'FORECAST'; output; end;
run;
proc sgplot data=b;
series x=time y=v/group=type;
refline 254/ axis = x LINEATTRS = (pattern=ShortDash);
run;