* * Investment example from starting page 386 * open data grunfeld2.dat cal(a) 1935 data(format=free,org=columns) 1935:1 1954:1 inv_ge v_ge k_ge inv_we v_we k_we * linreg inv_ge # constant v_ge k_ge compute rssge=%rss,ndfge=%ndf set ege = %resids linreg inv_we # constant v_we k_we set ewe = %resids * compute rsswe=%rss,ndfwe=%ndf cdf(title="Goldfeld-Quandt test") ftest (rssge/ndfge)/(rsswe/ndfwe) ndfge ndfwe * * This is how you do a (linear) SUR model using RATS. EQUATION defines a linear * relationship. The first of these creates an equation named GEEQ with dependent * variable INV_GE and explanatory variables CONSTANT V_GE and K_GE. * equation geeq inv_ge # constant v_ge k_ge equation weeq inv_we # constant v_we k_we * * This estimates a 2 equation system using the SUR technique. You'll note that * while the coefficients match exactly, the standard errors in RATS are lower by a * factor of sqrt(17/20). RATS is using the "maximum likelihood" estimate for the * (unknown) covariance matrix, while the software used in the text included * small-sample corrections. * sur 2 # geeq # weeq * * Test of equality restrictions. Because of the different choice above, the test * statistic will be different as well. * restrict 3 # 1 4 # 1.0 -1.0 0.0 # 2 5 # 1.0 -1.0 0.0 # 3 6 # 1.0 -1.0 0.0 * * Test for non-zero correlation * vcv # ege ewe compute lm=%nobs*%sigma(1,2)^2/(%sigma(1,1)*%sigma(2,2)) cdf(title="Test of zero correlation") chisqr lm 1