--------------------------------------------------------------------------------------- log: C:\Stata8\lab8-1dic.log log type: text opened on: 1 Dec 2004, 10:55:46 . set matsize 400 . clear . use "C:\Documents and Settings\computob.CUOTAS\Escritorio\NES92_clean.dta", clear . . ************************************************************************ . ** HOY VAMOS A ANALIZAR LA VARIABLE "PRESIDENTIAL APPROVAL" DE BUSH PAPA . ************************************************************************ . /* Para hacerlo usaremos el comando oprobit -- ordered probit > > */ . . summ Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- vote | 601 .8169717 .7186409 0 2 bushapp | 727 1.250344 1.078488 0 3 bplace | 678 5.150442 1.404075 1 7 cplace | 666 3.096096 1.340996 1 7 pplace | 587 4.381601 1.753846 1 7 -------------+-------------------------------------------------------- distbush | 575 2.106087 1.560917 0 6 distperot | 508 2.062992 1.414203 0 5 oppmilitary | 742 2.963612 .8279998 1 5 warok | 713 .5834502 .493333 0 1 education | 745 13.5651 2.574976 2 17 -------------+-------------------------------------------------------- govemployee | 750 .136 .3430173 0 1 union | 750 .1653333 .371729 0 1 nonwhite | 750 .1346667 .341595 0 1 place | 599 4.245409 1.730566 1 7 distclinton | 560 2.067857 1.528162 0 6 -------------+-------------------------------------------------------- badecon | 740 4.014865 .9061782 1 5 partyID | 742 -.1091644 1.999378 -3 3 income | 695 41.92734 30.33958 1.5 140 r1 | 745 .2722288 .0458215 .1040918 .3370141 r2 | 745 .3117232 .0111072 .228696 .3205123 -------------+-------------------------------------------------------- r3 | 745 .3454362 .0352465 .2958629 .4669528 r4 | 745 .0706118 .0211353 .0466106 .2002594 . . desc Contains data from C:\Documents and Settings\computob.CUOTAS\Escritorio\NES92_clean.dta obs: 750 vars: 22 24 Nov 2004 00:59 size: 69,000 (93.4% of memory free) ------------------------------------------------------------------------------- storage display value variable name type format label variable label ------------------------------------------------------------------------------- vote float %9.0g Vote 92: Bush, Clinton, Perot bushapp float %9.0g Bush Approval, 1992 bplace float %9.0g Bush Lib/Con cplace float %9.0g Clinton Lib/Con pplace float %9.0g Perot Lib/Con distbush float %9.0g R-Bush Lib/Con Dist distperot float %9.0g R-Perot Lib/Con Dist oppmilitary float %9.0g Opposition to Use of Military F warok float %9.0g Gulf War Worth Cost education float %9.0g Years of School govemployee float %9.0g Government Employee union float %9.0g Union Household nonwhite float %9.0g Nonwhite place float %9.0g R-Lib/Con distclinton float %9.0g R-Clinton Lib/Con Dist badecon float %9.0g Economy WORSE? partyID float %9.0g PartyID income float %9.0g FamilyIncome, $1000 r1 float %9.0g Pr(v2==0) r2 float %9.0g Pr(v2==1) r3 float %9.0g Pr(v2==2) r4 float %9.0g Pr(v2==3) ------------------------------------------------------------------------------- Sorted by: . . summ bushapp, detail Bush Approval, 1992 ------------------------------------------------------------- Percentiles Smallest 1% 0 0 5% 0 0 10% 0 0 Obs 727 25% 0 0 Sum of Wgt. 727 50% 1 Mean 1.250344 Largest Std. Dev. 1.078488 75% 2 3 90% 3 3 Variance 1.163137 95% 3 3 Skewness .2092042 99% 3 3 Kurtosis 1.719896 . hist bushapp (bin=26, start=0, width=.11538462) . . oprobit bushapp place distclinton badecon party educ income nonwhite, robust Iteration 0: log pseudo-likelihood = -694.25879 Iteration 1: log pseudo-likelihood = -556.97547 Iteration 2: log pseudo-likelihood = -554.78502 Iteration 3: log pseudo-likelihood = -554.77769 Iteration 4: log pseudo-likelihood = -554.77769 Ordered probit estimates Number of obs = 517 Wald chi2(7) = 238.28 Prob > chi2 = 0.0000 Log pseudo-likelihood = -554.77769 Pseudo R2 = 0.2009 ------------------------------------------------------------------------------ | Robust bushapp | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- place | .0971676 .0382998 2.54 0.011 .0221015 .1722338 distclinton | .1048759 .0455467 2.30 0.021 .0156061 .1941457 badecon | -.3540678 .0610805 -5.80 0.000 -.4737834 -.2343521 partyID | .2643179 .0343609 7.69 0.000 .1969718 .3316641 education | -.0549433 .0256694 -2.14 0.032 -.1052544 -.0046322 income | .0020283 .001666 1.22 0.223 -.001237 .0052935 nonwhite | -.2210481 .1712891 -1.29 0.197 -.5567687 .1146724 -------------+---------------------------------------------------------------- _cut1 | -2.123428 .4939492 (Ancillary parameters) _cut2 | -1.29324 .4871919 _cut3 | -.0153406 .4897463 ------------------------------------------------------------------------------ . . . oprobit bushapp place distclinton badecon party educ if e(sample), robust Iteration 0: log pseudo-likelihood = -694.25879 Iteration 1: log pseudo-likelihood = -558.62478 Iteration 2: log pseudo-likelihood = -556.52742 Iteration 3: log pseudo-likelihood = -556.52082 Iteration 4: log pseudo-likelihood = -556.52082 Ordered probit estimates Number of obs = 517 Wald chi2(5) = 226.83 Prob > chi2 = 0.0000 Log pseudo-likelihood = -556.52082 Pseudo R2 = 0.1984 ------------------------------------------------------------------------------ | Robust bushapp | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- place | .099103 .0377933 2.62 0.009 .0250295 .1731764 distclinton | .1045724 .0450646 2.32 0.020 .0162474 .1928973 badecon | -.3569849 .0609138 -5.86 0.000 -.4763738 -.237596 partyID | .2729435 .0334518 8.16 0.000 .2073791 .3385079 education | -.0435338 .0241288 -1.80 0.071 -.0908255 .0037578 -------------+---------------------------------------------------------------- _cut1 | -2.029767 .486004 (Ancillary parameters) _cut2 | -1.205004 .4800529 _cut3 | .0674304 .4832686 ------------------------------------------------------------------------------ . ** e(sample) restringe la regresion a la misma muestra de la ultima regresion en memo > ria . predict p0 p1 p2 p3 (option p assumed; predicted probabilities) (194 missing values generated) . hist p0 (bin=23, start=.00285099, width=.03760467) . hist p1 (bin=23, start=.02335817, width=.01289464) . . ** Engaņando a stata para obtener probabilidades predichas para casos especificos . ** p.ej. Como cambia la probabilidad de que me guste/disgute bush conforme aumenta la . ** cacion---manteniendo CONSTANTE TODO LO DEMAS... . . ** sustituir variables con el valor promedio de cada una de ellas... . . gen place2 = place (151 missing values generated) . gen distc2 = distclinton (190 missing values generated) . gen badecon2 = badecon (10 missing values generated) . gen party2 = partyID (8 missing values generated) . gen income2 = income (55 missing values generated) . . drop place distclinton badecon partyID income . . egen place=mean(place2) . egen distclinton = mean(distc2) . egen badecon = mean(badecon2) . egen partyID = mean(party2) . egen income = mean(income2) . . predict q1 q2 q3 q4 (option p assumed; predicted probabilities) (5 missing values generated) . . summ q* p* Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- q1 | 745 .2711791 .0360042 .1320762 .3214588 q2 | 745 .3121659 .0082503 .2531176 .3195435 q3 | 745 .3464982 .0278506 .3078235 .451403 q4 | 745 .0701568 .0160906 .0511742 .1634032 pplace | 587 4.381601 1.753846 1 7 -------------+-------------------------------------------------------- p0 | 556 .3311932 .2584872 .002851 .8677583 p1 | 556 .228551 .0785789 .0233582 .3199348 p2 | 556 .2942261 .1480024 .0254956 .4753509 p3 | 556 .1460297 .1737534 .0006567 .7476929 place2 | 599 4.245409 1.730566 1 7 -------------+-------------------------------------------------------- party2 | 742 -.1091644 1.999378 -3 3 place | 750 4.245409 0 4.245409 4.245409 partyID | 750 -.1091644 0 -.1091644 -.1091644 . . ** Ahora si podemos graficar la probabilidad de aprobacion a bush, . ** conforme aumenta la educacion . scatter q1 educ . scatter q2 educ . scatter q3 educ . scatter q4 educ . scatter q1 q2 q3 q4 educ . . log close log: C:\Stata8\lab8-1dic.log log type: text closed on: 1 Dec 2004, 10:56:18 ---------------------------------------------------------------------------------------