You are on page 1of 11

ENAHO 2018

COYLA YNCA ARTURO JHOSUE

do "C:\Users\HP\AppData\Local\Temp\STD4574_000000.tmp"

. cd"C:\Users\HP\Downloads\econometria 2 tarea\"

C:\Users\HP\Downloads\econometria 2 tarea

. use enaho01a-2018-300, clear

. format %30.0g p301a

. keep p301a p301b p301c ubigeo vivienda conglome hogar codperso

. gen edu=6+p301b if p301a== 5 | p301a==6

(83,740 missing values generated)

. replace edu=0 if p301a==1

(9,402 real changes made)

. replace edu=p301b if p301a==2

(6,439 real changes made)

. replace edu=max(p301b,p301c) if p301a==3

(26,925 real changes made)

. replace edu=6 if p301a==4

(14,556 real changes made)


. replace edu=11+p301b if p301a==7 | p301a==8 | p301a==9 | p301a==10

(24,773 real changes made)

. replace edu=16+p301b if p301a==11

(1,441 real changes made)

. drop if edu==.

(204 observations deleted)

. save educacion, replace

(note: file educacion.dta not found)

file educacion.dta saved

.
*****************************************************************************
*

> ****

. use enaho01a-2018-500, clear

. rename p530a INGRESO

. keep INGRESO p301a p208a p204 p207 ubigeo vivienda conglome hogar codperso

. drop if ING==999999

(0 observations deleted)

. drop if ING==.

(71,944 observations deleted)


. rename p301a educa

. drop if educa==.

(0 observations deleted)

. drop if educa==1

(1,670 observations deleted)

. drop if educa==2

(17 observations deleted)

. rename p208a edad

. gen edad2=edad^2

. *es miembro del hogar familiar?

. tab p204

�es miembro |

del hogar? | Freq. Percent Cum.

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

si | 25,960 99.79 99.79

no | 55 0.21 100.00

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

Total | 26,015 100.00

. keep if p204==1

(55 observations deleted)

. recode p207 (1=1) (2=0),gen(sexo)


(10490 differences between p207 and sexo)

. drop if sexo==.

(0 observations deleted)

. ttest INGRESO, by(sexo)

Two-sample t test with equal variances

------------------------------------------------------------------------------
Group | Obs Mean Std. Err. Std. Dev. [95% Conf. Interval]
---------+--------------------------------------------------------------------
0 | 10,490 608.1806 10.01885 1026.138 588.5418 627.8195
1 | 15,470 918.9033 12.04466 1498.096 895.2944 942.5122
---------+--------------------------------------------------------------------
combined | 25,960 793.3455 8.294661 1336.445 777.0875 809.6035
---------+--------------------------------------------------------------------
diff | -310.7226 16.79321 -343.6383 -277.807
------------------------------------------------------------------------------
diff = mean(0) - mean(1) t = -18.5029

Ho: diff = 0 degrees of freedom = 25958

Ha: diff < 0 Ha: diff != 0 Ha: diff > 0

Pr(T < t) = 0.0000 Pr(|T| > |t|) = 0.0000 Pr(T > t) = 1.0000

. tabstat INGRESO, by(sexo)

Summary for variables: INGRESO

by categories of: sexo (RECODE of p207 (sexo))

sexo | mean

---------+----------
0 | 608.1806

1 | 918.9033

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

Total | 793.3455

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

. reg INGRESO sexo

Source | SS df MS Number of obs = 25,960

-------------+---------------------------------- F(1, 25958) = 342.36

Model | 603541216 1 603541216 Prob > F = 0.0000

Residual | 4.5761e+10 25,958 1762902.54 R-squared = 0.0130

-------------+---------------------------------- Adj R-squared = 0.0130

Total | 4.6365e+10 25,959 1786084.41 Root MSE = 1327.7

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

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

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

sexo | 310.7226 16.79321 18.50 0.000 277.807 343.6383

_cons | 608.1806 12.96362 46.91 0.000 582.7712 633.5901

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

. twoway (scatter INGRESO sexo)

. tabstat INGRESO, statistics(mean count max cv) by(sexo)

Summary for variables: INGRESO

by categories of: sexo (RECODE of p207 (sexo))

sexo | mean N max cv

---------+----------------------------------------
0 | 608.1806 10490 20000 1.687225

1 | 918.9033 15470 35000 1.630309

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

Total | 793.3455 25960 35000 1.684568

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

. tabstat INGRESO, by(sexo)

Summary for variables: INGRESO

by categories of: sexo (RECODE of p207 (sexo))

sexo | mean

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

0 | 608.1806

1 | 918.9033

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

Total | 793.3455

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

. tabstat INGRESO, statistics(mean count max cv skewness kurtosis) by(educa)

Summary for variables: INGRESO

by categories of: educa (�cu�l es el �ltimo a�o o grado de estudios y nivel

> que aprob�? - nivel)

educa | mean N max cv skewness kurtosis

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

primaria incompl | 364.3449 5411 24268 2.045202 11.88408 268.0567

primaria complet | 472.6382 4881 18816 1.731638 7.967635 114.0362

secundaria incom | 712.2724 3914 17041 1.508743 5.452535 51.78518

secundaria compl | 931.115 6722 25360 1.371074 5.498561 58.06967


superior no univ | 1001.201 951 10602 1.167371 3.469265 22.27813

superior no univ | 1219.684 1705 20000 1.269623 4.191082 32.57811

superior univers | 1327.137 988 35000 1.52029 6.816888 89.6429

superior univers | 2022.228 1239 27000 1.361224 3.970055 25.60274

maestria/doctora | 2899.717 145 16667 .9256872 1.926857 7.989453

b�sica especial | 282.5 4 653 1.011657 .446947 1.647623

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

Total | 793.3455 25960 35000 1.684568 6.447405 78.71798

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

. tabstat INGRESO, by(sexo)

Summary for variables: INGRESO

by categories of: sexo (RECODE of p207 (sexo))

sexo | mean

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

0 | 608.1806

1 | 918.9033

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

Total | 793.3455

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

. ttest edu, by(sexo)

Two-sample t test with equal variances

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

Group | Obs Mean Std. Err. Std. Dev. [95% Conf. Interval]

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

0 | 10,490 5.274643 .0193237 1.979149 5.236764 5.312521


1 | 15,470 5.400776 .0158651 1.973271 5.369678 5.431873

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

combined | 25,960 5.349807 .0122677 1.97658 5.325762 5.373853

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

diff | -.1261332 .0249879 -.1751108 -.0771556

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

diff = mean(0) - mean(1) t = -5.0478

Ho: diff = 0 degrees of freedom = 25958

Ha: diff < 0 Ha: diff != 0 Ha: diff > 0

Pr(T < t) = 0.0000 Pr(|T| > |t|) = 0.0000 Pr(T > t) = 1.0000

. tabstat INGRESO, by(educa)

Summary for variables: INGRESO

by categories of: educa (�cu�l es el �ltimo a�o o grado de estudios y nivel

> que aprob�? - nivel)

educa | mean

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

primaria incompl | 364.3449

primaria complet | 472.6382

secundaria incom | 712.2724

secundaria compl | 931.115

superior no univ | 1001.201

superior no univ | 1219.684

superior univers | 1327.137

superior univers | 2022.228

maestria/doctora | 2899.717

b�sica especial | 282.5


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

Total | 793.3455

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

. keep ubigeo vivienda conglome hogar codperso edad edad2 educa sexo

. *p301b p301c

. regre INGRESO edad edad2 educa sexo

variable INGRESO not found

r(111);

end of do-file

r(111);

MI DUO FAIL
cd"C:\Users\HP\Downloads\econometria 2 tarea\"

use enaho01a-2018-300, clear

format %30.0g p301a

keep p301a p301b p301c ubigeo vivienda conglome hogar codperso

gen edu=6+p301b if p301a== 5 | p301a==6

replace edu=0 if p301a==1

replace edu=p301b if p301a==2

replace edu=max(p301b,p301c) if p301a==3

replace edu=6 if p301a==4

replace edu=11+p301b if p301a==7 | p301a==8 | p301a==9 | p301a==10

replace edu=16+p301b if p301a==11

drop if edu==.
save educacion, replace

*****************************************************************************
*****

use enaho01a-2018-500, clear

rename p530a INGRESO

keep INGRESO p301a p208a p204 p207 ubigeo vivienda conglome hogar codperso

drop if ING==999999

drop if ING==.

rename p301a educa

drop if educa==.

drop if educa==1

drop if educa==2

rename p208a edad

gen edad2=edad^2

*es miembro del hogar familiar?

tab p204

keep if p204==1

recode p207 (1=1) (2=0),gen(sexo)

drop if sexo==.

ttest INGRESO, by(sexo)

tabstat INGRESO, by(sexo)

reg INGRESO sexo

twoway (scatter INGRESO sexo)

tabstat INGRESO, statistics(mean count max cv) by(sexo)

tabstat INGRESO, by(sexo)

tabstat INGRESO, statistics(mean count max cv skewness kurtosis) by(educa)

tabstat INGRESO, by(sexo)


ttest edu, by(sexo)

tabstat INGRESO, by(educa)

keep ubigeo vivienda conglome hogar codperso edad edad2 educa sexo

*p301b p301c

regre INGRESO edad edad2 educa sexo

save ingreso.dta, replace

use ingreso, clear

merge 1:1 ubigeo vivienda conglome hogar codperso using educacion

format %30.0g educa

keep if _merge==3

drop if sexo==.

label values sexo sexo

label define sexo 1 "varón" 0 "mujer"

gen ln_w=ln(INGRESO)

anova ln_w educa

ttest ln_w, by(sexo)

drop if sexo==.

label values sexo sexo

label define sexo 1 "varón" 0 "mujer"

gen ln_w=ln(INGRESO)

anova ln_w educa

ttest ln_w, by(sexo)

You might also like