* PROBIT - Computing elasticities for log transformed variables. * * The data set on voting behaviour is from Pindyck and Rubinfeld, * Econometric Models and Economic Forecasts, * 1991, Third Edition, Table 10.8, p. 282; * 1998, Fourth Edition, Table 11.8, p. 332. * * The variables are: * YESVM = dummy variable equal to 1 if individual voted yes in the * election; 0 if individual voted no. * PUB12 = 1 if 1 or 2 childern in public school; = 0 otherwise * PUB34 = 1 if 3 or 4 childern in public school; = 0 otherwise * PUB5 = 1 if 5 or more childern in public school; = 0 otherwise * PRIV = 1 if 1 or more childern in private school; = 0 otherwise * YEARS = number of years living in the community * SCHOOL= 1 if individual is employed as a teacher; = 0 otherwise * LOGINC= logarithm of annual household income (in dollars) * PTCON = logarithm of property taxes (in dollars) paid per year * * Programmed by Diana Whistler e-mail: diana@shazam.econ.ubc.ca * Many thanks to Mohammed B. Abrar for his helpful suggestions. * SAMPLE 1 95 READ (school.txt) PUB12 PUB34 PUB5 PRIV YEARS SCHOOL LOGINC PTCON YESVM * LOGINC and PTCON are log-transformed variables. * Use the LOG option to get elasticities assuming log-transformed variables. PROBIT YESVM PUB12 PUB34 PUB5 PRIV YEARS SCHOOL LOGINC PTCON / LOG * Estimate the usual elasticities. PROBIT YESVM PUB12 PUB34 PUB5 PRIV YEARS SCHOOL LOGINC PTCON / & COEF=BETA PREDICT=YP * Save results GEN1 NOBS=$N GEN1 K=$K-1 GENR CONST=1 COPY PUB12 PUB34 PUB5 PRIV YEARS SCHOOL LOGINC PTCON CONST X COPY YP YHAT * NOTE: If SKIPIF commands are used then the next command is required. * DELETE SKIP$ * SHAZAM program to compute elasticities reported by PROBIT SET NOOUTPUT NODOECHO SAMPLE 1 NOBS * Calculating elasticities at mean STAT X / MEAN=XBAR * Evaluate at the sample mean MATRIX M=XBAR'BETA GEN1 F=NCDF(M) GEN1 FDEN=EXP(-M*M/2)/SQRT(2*$PI) * Calculate elasticities assuming variables are in levels. SAMPLE 1 K GENR EM=FDEN*BETA*XBAR/F * Now Calculate elasticities assuming LOG-transformed variables. GENR EML=FDEN*BETA/F * * Hensher-Johnson Weighted Aggregate Elasticity SAMPLE 1 NOBS GENR ONE=1 MATRIX MHJ=X*BETA GENR FDENHJ=EXP(-MHJ*MHJ/2)/SQRT(2*$PI) * Compute an N x K matrix -- Hadamard multiplication is used * Use SET NOWARN to suppress division by 0 messages SET NOWARN MATRIX HJ=(FDENHJ*BETA')/(1/X) SET WARN MATRIX WE=(ONE'*HJ)' * Now compute elasticities assuming log-transformed variables MATRIX WEL=(ONE'*(FDENHJ*BETA'))' STAT YHAT / SUMS=STOT SAMPLE 1 K GENR WE=WE/STOT GENR WEL=WEL/STOT * Print the different calculations for the elasticities: * EM - elasticities at mean * EML - elasticities at mean assuming log-transformed variables. * WE - weighted aggregate elasticity * WEL - weighted aggregate elasticity assuming log-transformed variables. SAMPLE 1 K PRINT BETA EM EML WE WEL STOP