* * Example 4.4 from pages 52-53 * open data tablef2-2[1].txt calendar 1960 data(format=prn,org=columns) 1960:1 1995:1 year g pg y pnc puc ppt pd pn ps pop * * Form the log variables needed. (The log function in RATS is the natural log). * set loggpop = log(g/pop) set logpg = log(pg) set loginc = log(y) set logpnc = log(pnc) set logpuc = log(puc) * linreg loggpop # constant logpg loginc logpnc logpuc * * You can get the critical value for the t-test with the function %INVTTEST. Note * that this gives the two-tailed critical value, which is what we want in this * case. Also note that the degrees of freedom of the regression is in %NDF. The * estimate of the income elasticity is the 3rd coefficient (thus %BETA(3)) and * its standard error is %STDERRS(3). Thus, we can do the entire calculation * without needing to put numbers into a calculator: * compute lower=%beta(3)-%invttest(.05,%ndf)*%stderrs(3) compute upper=%beta(3)+%invttest(.05,%ndf)*%stderrs(3) disp disp "95% confidence interval for income elasticity" lower upper * * Test-statistic. The text makes a slight error here. Because the test is * one-sided, not two, the .05 critical value should be from the .05 column in the * table, not the .025. When done with RATS, you use .10 on %INVTTEST, as the * function assumes a two-tailed test. An alternative way to do a test like this * is to compute the marginal significance level or p-value. If this is less than * the desired level (say .05), the null is rejected. This is done with the %TTEST * function. Since that also is designed for a two-tailed test, the resulting * p-value needs to be doubled. * compute tstat=(%beta(3)-1)/%stderrs(3) disp "Test Statistic for unitary elasticity" tstat disp "Critical value" %invttest(.10,%ndf) disp "P-value" #.###### 2*%ttest(tstat,%ndf)