* Analysis of Proportions Data * References: * William Greene, Econometric Analysis, Fourth Edition, * Chapter 19.4.6, pp. 834-837. * Gujarati, Basic Econometrics, Third Edition, * Chapter 16, pp. 556-561. SAMPLE 1 10 * Model of home ownership * Data set from Gujarati, Table 16.4, p. 557. * X = family income - thousands of \$ * NTOT = number of families in the group * N = number of families owning a house. READ X NTOT N 6 40 8 8 50 12 10 60 18 13 80 28 15 100 45 20 70 36 25 65 39 30 50 33 35 40 30 40 25 20 * Calculate the proportion of families that own a house in * each income group. GENR P=N/NTOT * Calculate the odds ratio in favor of owning a house. GENR ODDS=P/(1-P) * Calculate the logit -- the proportions are in the interval (0,1) * but the logit has the range on the real number line. GENR L=LOG(ODDS) * METHOD A: WLS (see Gujarati) * Consider heteroskedastic errors - calculate the weights GENR W=NTOT*P*(1-P) * Weighted Least Squares OLS L X / WEIGHT=W NONORM NOMULSIGSQ * Estimate the percent change in the weighted odds in favour of owning * a house for a unit increase in weighted income (X). * With the TEST command, this is reported as the TEST VALUE. TEST 100*(EXP(X)-1) * METHOD B: 2-step WLS (see Greene) * Use a 2-step estimation procedure * Step 1: OLS OLS L X / PREDICT=YHAT COEF=BETA * Calculate weights for the logit model GENR PHAT=EXP(YHAT)/(1+EXP(YHAT)) GENR W=NTOT*PHAT*(1-PHAT) * Step 2: Weighted Least Squares * The UT option is used to obtain PREDICTed values that are * UnTransformed (calculated with the unweighted data). OLS L X / WEIGHT=W NONORM NOMULSIGSQ UT PREDICT=LHAT COEF=BHAT TEST 100*(EXP(X)-1) * Predict the probability of owning a house at various income levels. GENR PHAT=EXP(LHAT)/(1+EXP(LHAT)) * Calculate marginal effects - the change in the probability of * owning a house per unit change in income. GENR MARGINAL=(BHAT:1)*PHAT*(1-PHAT) FORMAT(F12.0,2F12.3) PRINT X PHAT MARGINAL / FORMAT * METHOD C: Maximum Likelihood Estimation - Probit Model * Specify the log-likelihood function (see Greene, p. 836). FBX: NCDF(B1*X+B0) NL 1 / NCOEF=2 LOGDEN START=BETA EQ NTOT*(P*LOG([FBX])+(1-P)*LOG(1-[FBX])) END TEST 100*(EXP(B1)-1) STOP