Trabajo lohit
Xiomara Karolina Vilca CabreraDocumentos de Investigación18 de Agosto de 2017
22.339 Palabras (90 Páginas)267 Visitas
. // MODELOS PARA VARIABLES DEPENDIENTES ORDINALES EN STATA
.
. // Regression Models for Categorical Dependent Variables - 2nd Edition
. // Chapter 5 - Models for Ordinal Outcomes
. // Long and Freese – 27jul2005
. // Comentarios en español: Javier Aparicio - 3nov2008
. // (Ver DO FILE al final de este documento)
-------------------------------------------------------------------------------
log: D:\MyDocs\Metodos08\Long&FreeseSpost9\ch5_ordinal.log
log type: text
opened on: 30 Nov 2008, 20:45:08
. version 9
. * para que stata use sintaxis de version 9 (en caso de tener una versión posterior)
. set scheme s2manual // modo monocromático para gráficas
. set more off // para que el output del DO file no haga pausa al correr
. * Ejemplo de variable ordinal:
. * Actitudes frente a las madres que trabajan
. * Var dep: Esta de acuerdo o no con la frase:
. * "Las mamas que trabajan pueden mantener relaciones calidas con sus hijos"
.
. sysuse ordwarm2, clear
(77 & 89 General Social Survey)
. desc warm yr89 male white age ed prst
storage display value
variable name type format label variable label
-------------------------------------------------------------------------------
warm byte %10.0g sd2sa Mom can have warm relations
with child
yr89 byte %10.0g yrlbl Survey year: 1=1989 0=1977
male byte %10.0g sexlbl Gender: 1=male 0=female
white byte %10.0g race2lbl Race: 1=white 0=not white
age byte %10.0g Age in years
ed byte %10.0g Years of education
prst byte %10.0g Occupational prestige
. sum warm yr89 male white age ed prst
Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
warm | 2293 2.607501 .9282156 1 4
yr89 | 2293 .3986044 .4897178 0 1
male | 2293 .4648932 .4988748 0 1
white | 2293 .8765809 .3289894 0 1
age | 2293 44.93546 16.77903 18 89
-------------+--------------------------------------------------------
ed | 2293 12.21805 3.160827 0 20
prst | 2293 39.58526 14.49226 12 82
.
. tab warm
. *(“Working mom’s can have warm relations with children”)
Mom can |
have warm |
relations |
with child | Freq. Percent Cum.
------------+-----------------------------------
1SD | 297 12.95 12.95
2D | 723 31.53 44.48
3A | 856 37.33 81.81
4SA | 417 18.19 100.00
------------+-----------------------------------
Total | 2,293 100.00
. * Var. Dep.: ¿Está de acuerdo o no con la frase?
. * "Las mamás que trabajan pueden mantener relaciones calidas con sus hijos"
.
. // Un modelo de regresión logístico ordinal
. ologit warm male white age ed prst, nolog // muestra completa
Ordered logistic regression Number of obs = 2293
LR chi2(5) = 258.39
Prob > chi2 = 0.0000
Log likelihood = -2866.5752 Pseudo R2 = 0.0431
------------------------------------------------------------------------------
warm | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
male | -.7499562 .0783083 -9.58 0.000 -.9034377 -.5964747
white | -.4127267 .1180436 -3.50 0.000 -.6440879 -.1813655
age | -.0206757 .0024598 -8.41 0.000 -.0254967 -.0158547
ed | .0789344 .0158731 4.97 0.000 .0478238 .1100451
prst | .0066996 .0032863 2.04 0.041 .0002585 .0131408
-------------+----------------------------------------------------------------
/cut1 | -2.466022 .2386009 -2.933671 -1.998373
/cut2 | -.6564482 .2329347 -1.112992 -.1999045
/cut3 | 1.215503 .2335542 .7577454 1.673261
------------------------------------------------------------------------------
. * la opcion nolog omite el output de las iteraciones
. ologit warm male white age ed prst if yr89==1, nolog // muestra restringida
Ordered logistic regression Number of obs = 914
LR chi2(5) = 91.02
Prob > chi2 = 0.0000
Log likelihood = -1083.2871 Pseudo R2 = 0.0403
------------------------------------------------------------------------------
warm | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
male | -.7589487 .1265685 -6.00 0.000 -1.007018 -.510879
white | -.3579802 .18615 -1.92 0.054 -.7228275 .0068671
age | -.0227585 .0038285 -5.94 0.000 -.0302621 -.0152548
ed | .0421346 .025821 1.63 0.103 -.0084737 .0927429
prst | .0094713 .0049673 1.91 0.057 -.0002645 .019207
-------------+----------------------------------------------------------------
/cut1 | -3.528722 .4055 -4.323487 -2.733957
/cut2 | -1.380973 .3850552 -2.135668 -.6262787
/cut3 | .6297378 .3821996 -.1193596 1.378835
------------------------------------------------------------------------------
.
. * comparando ORDINAL LOGIT con ORDINAL PROBIT
. ologit warm yr89 male white age ed prst, nolog
Ordered logistic regression Number of obs = 2293
LR chi2(6) = 301.72
Prob > chi2 = 0.0000
Log likelihood = -2844.9123 Pseudo R2 = 0.0504
------------------------------------------------------------------------------
warm | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
yr89 | .5239025 .0798988 6.56 0.000 .3673037 .6805013
male | -.7332997 .0784827 -9.34 0.000 -.8871229 -.5794766
white | -.3911595 .1183808 -3.30 0.001 -.6231815 -.1591374
...