** Chapter 11.3.2 ** for W.H. Greene, Econometric Analysis 6th ed. ***************** * (c) Noel Roy 2003, 2008 * * NONLINEAR REGRESSIONS AND NONLINEAR LEAST SQUARES * Section 11.3.2 (p. 296-297) The Box-Cox transformation. * * * This tutorial reviews Box-Cox variable transformations (BOX command)in SHAZAM. * *=============================================================================== * * We are replicating the production function model of Zellner and Revankar, * which is the subject of questions 2-3 in the Applications for Chapter 11 * (p. 312). The Zellner-Tevankar data in Table F5.2 include character * data identifying the U.S. state to which the data pertain. * * It is possible to read character data (in this case the state names) using * the FORMAT command. The READ command must specify the FORMAT option, * and must be preceded by a FORMAT command specifying a FORTRAN-type * data format. See pp. 29-30 of the SHAZAM User's Reference Manual for details. * * Because SHAZAM character variables can store no more than 8 letters, * and Massachusetts is 13 characters long, we must store the names in * two character variables. * SAMPLE 1 25 FORMAT (A8, A5, 4F13.0) READ (TableF14-1.prn) STATE1 STATE2 OUTPUT CAPITAL LABOR ESTAB / SKIPLINES=1 FORMAT * * The data set will be printed in order to confirm that it has been read * properly. As with the READ command, PRINTing character data requires * a FORMAT option and must be preceded by a FORMAT command. * Note that, when printing, the FORMAT command should start with * one column advance to avoid possible problems when sending the output * file to a printer. * FORMAT (1X, A8, A5, 4F13.3) PRINT STATE1 STATE2 OUTPUT CAPITAL LABOR ESTAB / FORMAT * * Divide the data by the number of establishments. * GENR Y=OUTPUT/ESTAB GENR K=CAPITAL/ESTAB GENR L=LABOR/ESTAB * * The BOX command provides features for estimation with Box-Cox transformations. * The general format for unrestricted estimation is: * * BOX depvar indepvars / options * * The general form for restricted estimation is: * * BOX depvar indepvars / RESTRICT options * LAMBDA var1=value1 var2=value2 ... * RESTRICT equation * END * * The ALL option is used to extend the Box-Cox model so that all variables * recieve the same power transformation (unless restricted). Otherwise only * the dependent variable is transformed. The RESTRICT * option forces linear parameter restrictions. These restrictions are * specified with the LAMBDA and/or RESTRICT command. In the specification * below, the dependent variable is restricted to a Lambda=0 (which is * equivalent to lnY). The BOX command is described further in Chapter 12 of * the SHAZAM Manusl. * BOX Y K L / ALL RESTRICT PCOV COEF=b LAMBDA Y=0 END GEN1 SIG=$SIG2 GEN1 LLF=$LLF * * Calculate output elasticities of capital and labour at their * sample means. These are evaluated at b(k)*kbar**lLambda for * capital and similarly for labour. * ?STAT K L /MEAN=IBAR * Capital elasticity GEN1 B(1)*IBAR(1)**b(4) * Labour elasticity GEN1 B(2)*IBAR(2)**b(5) * * Unfortunately, SHAZAM does not calculate a standard error * for Lambda, so we cannot immediately run any tests on it. * Moreover, the standard errors reported for the other parameters * are CONDITIONAL on the estimate of Lambda, and so are * underestimates of the proper unconditional standard error (see * Greene, p. 297 for a discussion). * * Calculation of the unconditional asymptotic covariance matrix * (inclusive of Lambda) requires calculation of the pseudo- * regrsssors (11-16). * GENR X1=1 GENR X2=(K**b(4)-1)/b(4) GENR X3=(L**b(5)-1)/b(4) GENR X4=(b(1)*(K**b(4)*LOG(K)-X2)+b(2)*(L**b(4)*LOG(L)-X3))/b(4) * * Now compute the aymptotic covariance matrix as per (11-12), * with the matrix X0 of the above pseudoregressors. * COPY X1 X2 X3 X4 X0 MATRIX X0X0=X0'X0 MATRIX COV=SIG*INV(X0X0) PRINT COV * * Print the corrected standard errors. The order is the constant term, * K, L, and Lambda. * MATRIX SE=SQRT(DIAG(COV)) PRINT se * * The Wald statistic for testing the hypothesis that Lambda=0 * is the square of the usual t-ratio. * GEN1 WALD=(b(4)/SE(4))**2 * * Lagrange multiplier tests can be based * on the Restricted Model, which is equivalent to Cobb-Douglas. * GENR LNY=LOG(Y) GENR LNK=LOG(K) GENR LNL=LOG(L) OLS LNY LNK LNL /RESID=E COEF=C LOGLOG GEN1 LLFCD=$LLF * * The LM test is based on the regression of the restricted * model (Cobb-Douglas) residuals on the Box-Cox pseudo * regressors evaluated at the restricted model. These pseudoregressors are * a constant, LNK, LNL, and a pseudoregressor for Lambda. The test statistic * is the sample size times R-squared. * GENR PSLAMBDA=0.5*(C(1)*LNK**2+C(2)*LNL**2) ?OLS E LNK LNL PSLAMBDA GEN1 LM=$N*$R2 * * Calculate the p-values for the these tests, which are all asyptotically * distributed as chi-squared with 1 d.f. * DISTRIB WALD LM /TYPE=CHI DF=1 * * Both point to strong rejection of the restricted * model. * STOP * *=============================================================================== * * Updated September 29, 2008