/* ** Autocorrelated Regression Models: ** Nonlinear Maximum Likelikood Estimation ** AR(1), MA(1), ARMA(1,1) ** Greene [1999], Chap. 13 */ use gpe2; n=21; load data[n,5]=c:\course07\xmu\usinv.txt; rinv=data[2:n,3]./data[2:n,4]; @ real investment @ rgnp=data[2:n,2]./data[2:n,4]; @ real GNP @ rate=data[2:n,5]- @ real interest rate @ 100*(data[2:n,4]-lagn(data[2:n,4],1))./lagn(data[2:n,4],1); data=packr(rinv~rate~rgnp); data=data~ones(rows(data),1); /* data matrix is arranged with the dependent variable in the first column, followed by colums of independent variables including constant */ @ OLS estimates as Table 13.2 of Greene [1999] @ b=data[.,1]/data[.,2:4]; /* test for model specification */ /* call reset; _rplot=2; _rtest={1,1,5,5}; _acf=10; _acf2=10; call estimate(data[.,1],data[.,2:3]); */ _nlopt=1; _method=3; _iter=200; _print=0; _arma={1,0}; call estimate(data[.,1],data[.,2:3]); _arma={0,1}; call estimate(data[.,1],data[.,2:3]); _arma={1,1,0.5,-0.5}; call estimate(data[.,1],data[.,2:3]); end;