Está en la página 1de 11

. use "C:\Users\Usuario\Documents\practica 4\data.

dta"

. do "C:\Users\Usuario\AppData\Local\Temp\STD00000000.tmp"

. global y1list hlthe

. global y2list dmdu

. global xlist age linc ndisease

. global zlist age linc

. describe

Contains data from C:\Users\Usuario\Documents\practica 4\data.dta

obs: 5,574

vars: 7 6 Oct 2017 16:32

size: 156,072

--------------------------------------------------------------------------------------------------------
--------

storage display value

variable name type format label variable label

--------------------------------------------------------------------------------------------------------
--------

age float %9.0g age

ndisease float %9.0g count of chronic diseases

linc float %9.0g log of annual family income (in $)

dmdu float %9.0g =1 if visited doctor

hlthe float %9.0g =1 if excellent health

biprrob1 float %9.0g Pr(hlthe=1)

biprrob2 float %9.0g Pr(dmdu=1)

--------------------------------------------------------------------------------------------------------
--------

Sorted by:

. summarize $y1list $y2list $xlist

Variable | Obs Mean Std. Dev. Min Max

-------------+--------------------------------------------------------

hlthe | 5574 .541263 .4983392 0 1

dmdu | 5574 .6713312 .4697715 0 1

age | 5574 25.57613 16.73011 .0253251 63.27515


linc | 5574 8.696929 1.220592 0 10.28324

ndisease | 5574 11.20526 6.788959 0 58.6

. tabulate $y1list $y2list

=1 if |

excellent | =1 if visited doctor

health | 0 1 | Total

-----------+----------------------+----------

0 | 826 1,731 | 2,557

1 | 1,006 2,011 | 3,017

-----------+----------------------+----------

Total | 1,832 3,742 | 5,574

. * modelo probit

. probit $y1list $xlist

Iteration 0: log likelihood = -3844.5998

Iteration 1: log likelihood = -3554.609

Iteration 2: log likelihood = -3554.1955

Iteration 3: log likelihood = -3554.1955

Probit regression Number of obs = 5574

LR chi2(3) = 580.81

Prob > chi2 = 0.0000

Log likelihood = -3554.1955 Pseudo R2 = 0.0755

------------------------------------------------------------------------------

hlthe | Coef. Std. Err. z P>|z| [95% Conf. Interval]

-------------+----------------------------------------------------------------

age | -.0178193 .0010826 -16.46 0.000 -.0199412 -.0156975

linc | .1325079 .014975 8.85 0.000 .1031576 .1618583

ndisease | -.0326532 .0027587 -11.84 0.000 -.0380602 -.0272462

_cons | -.2304379 .1335596 -1.73 0.084 -.49221 .0313341

------------------------------------------------------------------------------

. probit $y2list $xlist

Iteration 0: log likelihood = -3529.6346

Iteration 1: log likelihood = -3405.19

Iteration 2: log likelihood = -3404.6444


Iteration 3: log likelihood = -3404.6444

Probit regression Number of obs = 5574

LR chi2(3) = 249.98

Prob > chi2 = 0.0000

Log likelihood = -3404.6444 Pseudo R2 = 0.0354

------------------------------------------------------------------------------

dmdu | Coef. Std. Err. z P>|z| [95% Conf. Interval]

-------------+----------------------------------------------------------------

age | .0020078 .0010926 1.84 0.066 -.0001335 .0041492

linc | .1212854 .0142546 8.51 0.000 .0933469 .1492238

ndisease | .0347235 .0028911 12.01 0.000 .029057 .0403899

_cons | -1.033029 .1290841 -8.00 0.000 -1.286029 -.7800286

------------------------------------------------------------------------------

. * model probit bivariado

. biprobit $y1list $y2list $xlist

Fitting comparison equation 1:

Iteration 0: log likelihood = -3844.5998

Iteration 1: log likelihood = -3554.609

Iteration 2: log likelihood = -3554.1955

Iteration 3: log likelihood = -3554.1955

Fitting comparison equation 2:

Iteration 0: log likelihood = -3529.6346

Iteration 1: log likelihood = -3405.19

Iteration 2: log likelihood = -3404.6444

Iteration 3: log likelihood = -3404.6444

Comparison: log likelihood = -6958.8398

Fitting full model:

Iteration 0: log likelihood = -6958.8398

Iteration 1: log likelihood = -6958.0751

Iteration 2: log likelihood = -6958.0751


Bivariate probit regression Number of obs = 5574

Wald chi2(6) = 770.00

Log likelihood = -6958.0751 Prob > chi2 = 0.0000

------------------------------------------------------------------------------

| Coef. Std. Err. z P>|z| [95% Conf. Interval]

-------------+----------------------------------------------------------------

hlthe |

age | -.0178246 .0010827 -16.46 0.000 -.0199466 -.0157025

linc | .132468 .0149632 8.85 0.000 .1031406 .1617953

ndisease | -.0326656 .0027589 -11.84 0.000 -.0380729 -.0272583

_cons | -.2297079 .1334526 -1.72 0.085 -.4912703 .0318545

-------------+----------------------------------------------------------------

dmdu |

age | .0020038 .0010927 1.83 0.067 -.0001379 .0041455

linc | .1212519 .0142512 8.51 0.000 .09332 .1491838

ndisease | .0347111 .0028908 12.01 0.000 .0290452 .0403771

_cons | -1.032527 .1290517 -8.00 0.000 -1.285464 -.7795907

-------------+----------------------------------------------------------------

/athrho | .0282258 .022827 1.24 0.216 -.0165142 .0729658

-------------+----------------------------------------------------------------

rho | .0282183 .0228088 -.0165127 .0728366

------------------------------------------------------------------------------

Likelihood-ratio test of rho=0: chi2(1) = 1.5295 Prob > chi2 = 0.2162

INTERPRETACION: LA EDAD ES SIGNIFICANTE AL 10%

. * prediccion marginal de las probabilidades de y1=1 y y2=1

. predict biprob1, pmarg1

. predict biprob2, pmarg2

. *prediccion de probabilidades conjuntas de Y1=0 y Y2=0, y Y1=0 y Y2=1, Y1=1 y Y2=0, y Y1=1 y Y2=1

. predict biprob00, p00

. predict biprob01, p01

. predict biprob10, p10


. predict biprob11, p11

. * valores predecidos resumidos

. summarize $y1list $y2list biprob1 biprob2

Variable | Obs Mean Std. Dev. Min Max

-------------+--------------------------------------------------------

hlthe | 5574 .541263 .4983392 0 1

dmdu | 5574 .6713312 .4697715 0 1

biprob1 | 5574 .5414237 .1577588 .0156161 .7853771

biprob2 | 5574 .6716857 .0976294 .1589158 .9834746

. summarize biprob00 biprob01 biprob10 biprob11

Variable | Obs Mean Std. Dev. Min Max

-------------+--------------------------------------------------------

biprob00 | 5574 .1479458 .064902 .0158778 .6909308

biprob01 | 5574 .3106305 .1434517 .1090853 .9385432

biprob10 | 5574 .1803685 .0765047 .0006476 .3680022

biprob11 | 5574 .3610553 .0989285 .0090629 .5492701

. tabulate $y1list $y2list

=1 if |

excellent | =1 if visited doctor

health | 0 1 | Total

-----------+----------------------+----------

0 | 826 1,731 | 2,557

1 | 1,006 2,011 | 3,017

-----------+----------------------+----------

Total | 1,832 3,742 | 5,574

INTERPRETACION: 1006 PERSONAS NO VAN AL HOSPITAL PERO TIENEN BUENA SALUD

. * efectos marginales

. margins, dydx(*) atmeans predict (p00)

Conditional marginal effects Number of obs = 5574

Model VCE : OIM

Expression : Pr(hlthe=0,dmdu=0), predict(p00)


dy/dx w.r.t. : age linc ndisease

at : age = 25.57613 (mean)

linc = 8.696929 (mean)

ndisease = 11.20526 (mean)

------------------------------------------------------------------------------

| Delta-method

| dy/dx Std. Err. z P>|z| [95% Conf. Interval]

-------------+----------------------------------------------------------------

age | .0019506 .0002356 8.28 0.000 .0014888 .0024123

linc | -.0372013 .0031362 -11.86 0.000 -.0433481 -.0310546

ndisease | -.0016018 .0006109 -2.62 0.009 -.0027992 -.0004045

------------------------------------------------------------------------------

. margins, dydx(*) atmeans predict (p01)

Conditional marginal effects Number of obs = 5574

Model VCE : OIM

Expression : Pr(hlthe=0,dmdu=1), predict(p01)

dy/dx w.r.t. : age linc ndisease

at : age = 25.57613 (mean)

linc = 8.696929 (mean)

ndisease = 11.20526 (mean)

------------------------------------------------------------------------------

| Delta-method

| dy/dx Std. Err. z P>|z| [95% Conf. Interval]

-------------+----------------------------------------------------------------

age | .0051246 .0003444 14.88 0.000 .0044496 .0057996

linc | -.0153798 .0046681 -3.29 0.001 -.0245292 -.0062304

ndisease | .0145679 .000892 16.33 0.000 .0128197 .0163161

------------------------------------------------------------------------------

. margins, dydx(*) atmeans predict (p10)

Conditional marginal effects Number of obs = 5574

Model VCE : OIM

Expression : Pr(hlthe=1,dmdu=0), predict(p10)

dy/dx w.r.t. : age linc ndisease

at : age = 25.57613 (mean)


linc = 8.696929 (mean)

ndisease = 11.20526 (mean)

------------------------------------------------------------------------------

| Delta-method

| dy/dx Std. Err. z P>|z| [95% Conf. Interval]

-------------+----------------------------------------------------------------

age | -.002669 .0002531 -10.55 0.000 -.003165 -.0021729

linc | -.0062709 .0033442 -1.88 0.061 -.0128254 .0002836

ndisease | -.0108431 .0006603 -16.42 0.000 -.0121373 -.009549

------------------------------------------------------------------------------

. margins, dydx(*) atmeans predict (p11)

Conditional marginal effects Number of obs = 5574

Model VCE : OIM

Expression : Pr(hlthe=1,dmdu=1), predict(p11)

dy/dx w.r.t. : age linc ndisease

at : age = 25.57613 (mean)

linc = 8.696929 (mean)

ndisease = 11.20526 (mean)

------------------------------------------------------------------------------

| Delta-method

| dy/dx Std. Err. z P>|z| [95% Conf. Interval]

-------------+----------------------------------------------------------------

age | -.0044062 .0003641 -12.10 0.000 -.0051199 -.0036925

linc | .0588521 .0049099 11.99 0.000 .0492288 .0684754

ndisease | -.002123 .0009445 -2.25 0.025 -.0039743 -.0002717

------------------------------------------------------------------------------

. correlate $y1list $y2list

(obs=5574)

| hlthe dmdu

-------------+------------------

hlthe | 1.0000

dmdu | -0.0110 1.0000

TIENE CORRELACION BAJA


. * modelo probit

. probit $y1list $xlist

Iteration 0: log likelihood = -3844.5998

Iteration 1: log likelihood = -3554.609

Iteration 2: log likelihood = -3554.1955

Iteration 3: log likelihood = -3554.1955

Probit regression Number of obs = 5574

LR chi2(3) = 580.81

Prob > chi2 = 0.0000

Log likelihood = -3554.1955 Pseudo R2 = 0.0755

------------------------------------------------------------------------------

hlthe | Coef. Std. Err. z P>|z| [95% Conf. Interval]

-------------+----------------------------------------------------------------

age | -.0178193 .0010826 -16.46 0.000 -.0199412 -.0156975

linc | .1325079 .014975 8.85 0.000 .1031576 .1618583

ndisease | -.0326532 .0027587 -11.84 0.000 -.0380602 -.0272462

_cons | -.2304379 .1335596 -1.73 0.084 -.49221 .0313341

------------------------------------------------------------------------------

. probit $y2list $xlist

Iteration 0: log likelihood = -3529.6346

Iteration 1: log likelihood = -3405.19

Iteration 2: log likelihood = -3404.6444

Iteration 3: log likelihood = -3404.6444

Probit regression Number of obs = 5574

LR chi2(3) = 249.98

Prob > chi2 = 0.0000

Log likelihood = -3404.6444 Pseudo R2 = 0.0354

------------------------------------------------------------------------------

dmdu | Coef. Std. Err. z P>|z| [95% Conf. Interval]

-------------+----------------------------------------------------------------

age | .0020078 .0010926 1.84 0.066 -.0001335 .0041492

linc | .1212854 .0142546 8.51 0.000 .0933469 .1492238


ndisease | .0347235 .0028911 12.01 0.000 .029057 .0403899

_cons | -1.033029 .1290841 -8.00 0.000 -1.286029 -.7800286

------------------------------------------------------------------------------

end of do-file

. do "C:\Users\Usuario\AppData\Local\Temp\STD00000000.tmp"

. probit $y1list $xlist

Iteration 0: log likelihood = -3844.5998

Iteration 1: log likelihood = -3554.609

Iteration 2: log likelihood = -3554.1955

Iteration 3: log likelihood = -3554.1955

Probit regression Number of obs = 5574

LR chi2(3) = 580.81

Prob > chi2 = 0.0000

Log likelihood = -3554.1955 Pseudo R2 = 0.0755

------------------------------------------------------------------------------

hlthe | Coef. Std. Err. z P>|z| [95% Conf. Interval]

-------------+----------------------------------------------------------------

age | -.0178193 .0010826 -16.46 0.000 -.0199412 -.0156975

linc | .1325079 .014975 8.85 0.000 .1031576 .1618583

ndisease | -.0326532 .0027587 -11.84 0.000 -.0380602 -.0272462

_cons | -.2304379 .1335596 -1.73 0.084 -.49221 .0313341

------------------------------------------------------------------------------

. mfx

Marginal effects after probit

y = Pr(hlthe) (predict)

= .53996178

------------------------------------------------------------------------------

variable | dy/dx Std. Err. z P>|z| [ 95% C.I. ] X

---------+--------------------------------------------------------------------

age | -.0070732 .00043 -16.45 0.000 -.007916 -.00623 25.5761

linc | .0525976 .00595 8.85 0.000 .040943 .064252 8.69693

ndisease | -.0129613 .0011 -11.82 0.000 -.01511 -.010813 11.2053

------------------------------------------------------------------------------
INTERPRETACION: SI EL INGRESO DE LA PERSONA INCREMENTA EN UNO PORCIENTO LA PROB DE QUE LA PERSONA TENGA
UNA SALUD EXCELENTE ES DEL 1%

. probit $y2list $xlist

Iteration 0: log likelihood = -3529.6346

Iteration 1: log likelihood = -3405.19

Iteration 2: log likelihood = -3404.6444

Iteration 3: log likelihood = -3404.6444

Probit regression Number of obs = 5574

LR chi2(3) = 249.98

Prob > chi2 = 0.0000

Log likelihood = -3404.6444 Pseudo R2 = 0.0354

------------------------------------------------------------------------------

dmdu | Coef. Std. Err. z P>|z| [95% Conf. Interval]

-------------+----------------------------------------------------------------

age | .0020078 .0010926 1.84 0.066 -.0001335 .0041492

linc | .1212854 .0142546 8.51 0.000 .0933469 .1492238

ndisease | .0347235 .0028911 12.01 0.000 .029057 .0403899

_cons | -1.033029 .1290841 -8.00 0.000 -1.286029 -.7800286

------------------------------------------------------------------------------

. mfx

Marginal effects after probit

y = Pr(dmdu) (predict)

= .67803815

------------------------------------------------------------------------------

variable | dy/dx Std. Err. z P>|z| [ 95% C.I. ] X

---------+--------------------------------------------------------------------

age | .0007199 .00039 1.84 0.066 -.000048 .001487 25.5761

linc | .0434836 .00512 8.50 0.000 .033457 .05351 8.69693

ndisease | .0124492 .00103 12.07 0.000 .010428 .01447 11.2053

------------------------------------------------------------------------------

INTERPRETACION: SI EL INGREDSO DE LA PERSONA INCREMENTA EN UNO


PORCIENTO LA PROB DE QUE VISITE AL DOCTOR ES DEL 4.3%
.

end of do-file
LA PRIMERA PERSONA DE QUE ESTE EN UN BUEN ESTADO ES DE 42.1% (BIPROB 1)

LA PRIMERA PERSONA DE QUE VISITE ALA DOCTOR ES DE 75% (BIPROB 1)

predict biprob00, p00

predict biprob01, p01

predict biprob10, p10 PRO DE QUE

predict biprob11, p11 PRO DE QUE

SACAME LA PROB DE QUE VISITE AL MEDICO Y QUE TAMBIEN ESTE EN UN BUEN ESTADO DE SALID

PARA LA PERSONA UNO