OPTIONS CRT; ? name dpdx 'Standard Errors for Probability Derivatives - Logit' ; ? ? Example of computing VCOV/SEs for dP/dX from Logit. This example ? has two right hand side variables (plus the intercept). ? TSP 4.2B (June 1994) ? Author: Clint Cummins ? SET T=100; SMPL 1,T; ? Here we generate some random data for Logit RANDOM(SEED=2497) X1 X2; DOT 0 1; RANDOM(UNIFORM) F; U. = -LOG(-LOG(F)); ? Type I Extreme Value ENDDOT; XB0 = U0; XB1 = .6 + X1 + 2*X2 + U1; Y = (XB1 > XB0); ? Y = 0 if XB0 >= XB1, or Y = 1 if XB1 > XB0 ? ? Now do the estimation using the simulated data. ? LOGIT Y C X1 X2; LIST @RNMS B0-B2; ? rename coefs for ANALYZ UNMAKE @COEF @RNMS; PARAM @RNMS; FRML EPL P1 = 1/(1 + EXP(-(B0 + B1*X1 + B2*X2))); DIFFER EPL X1 X2; ? This creates FRMLs for the derivatives. MFORM(NROW=2,TYPE=SYM) VCMEAN = 0; MFORM(NROW=2,NCOL=1) BMEAN = 0; SUPRES SMPL,COEF; DO I=1,T; SMPL I,I; ANALYZ(SILENT) DEPL1 DEPL2; MADD VCMEAN @VCOVA VCMEAN; MADD BMEAN @COEFA BMEAN; ? mean of dP/dX, to check against Logit. ENDDO; MAT VCMEAN = VCMEAN/T; MAT BMEAN = BMEAN/T; SUPRES; ? Turn off the suppression of output. TSTATS(NAMES=(DPDX1,DPDX2)) BMEAN VCMEAN;