** Chapter 6.2 ** for W.H. Greene, Econometric Analysis 6th ed. ***************** * (c) Noel Roy 2003, 2008 * * USING BINARY VARIABLES * * The tutorial for this section will review the following tasks in SHAZAM: * • Use of index variables in DO commands * • Storing coefficient estimates * • TEST command * *=============================================================================== * * 7.2 USING BINARY VARIABLES * Example 6.2 (P. 108) Analysis of Covariance * READ (TableF6-1.prn)I T C Q PFuel LoadFact /SKIPLINES=1 * * Because no SAMPLE command is active, the entire data set is * loaded and SAMPLE is set implicitly. * GENR LNC=LOG(C) GENR LNQ=LOG(Q) GENR LNQ2=LNQ**2 GENR LNPF=LOG(PFuel) * * Create the dummies representing the time and firm effects. * A DO command creates 14 time dummies, named D1, D2, ... D14, * using the DUM function, which has a value of 1 when its * argument is positive and 0 otherwise. The argument used here * is 1-(T-#)**2 for all values 0f # between 1 and 14. Clearly, * such a variable equals 1 for T=# and <= 0 otherwise. * Similarly, five firm dummies F1, F2, . . .F5 are created. * SET NODOECHO DO #=1,14 GENR D#=DUM(1-(T-#)**2) ENDO DO #=1,5 GENR F#=DUM(1-(I-#)**2) ENDO * * Estimate the full model. Note that the dummies can be * represented is a variable list as D1-D14 and F1-F5 respectively. * Generally, any set of variable names with a common stem and ending * with a set of contiguous numbers can be so represented in SHAZAM. * OLS LNC LNQ LNQ2 LNPF LoadFact D1-D14 F1-F5 /COEF=B * * Test the Time Effects model, where there are no firm effects. * TEST TEST F1 TEST F2 TEST F3 TEST F4 TEST F5 END * * Test the Firm effects model, where there are no time effects. * TEST TEST D1 TEST D2 TEST D3 TEST D4 TEST D5 TEST D6 TEST D7 TEST D8 TEST D9 TEST D10 TEST D11 TEST D12 TEST D13 TEST D14 END * Test against the No Effects model. TEST TEST D1 TEST D2 TEST D3 TEST D4 TEST D5 TEST D6 TEST D7 TEST D8 TEST D9 TEST D10 TEST D11 TEST D12 TEST D13 TEST D14 TEST F1 TEST F2 TEST F3 TEST F4 TEST F5 END * * Replicate Figure 6.1. The year dummy variables are stored * as elements 5-18 of vector B, the vector of coefficients saved * in the OLS command. (Elements 1-4 are the coefficients of the * variables LNQ LNQ2 LNPF and LoadFact. * SAMPLE 5 18 GENR YEAR=TIME(-4) GRAPH B YEAR /NOKEY STOP * *=============================================================================== * * Updated September 2, 2008