EJEMPLO

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Tuesday March 5 19:23:59 2024 Page 1

___ ____ ____ ____ ____(R)


/__ / ____/ / ____/
___/ / /___/ / /___/
Statistics/Data Analysis

___ ____ ____ ____ ____ (R)


/__ / ____/ / ____/
___/ / /___/ / /___/ 15.0 Copyright 1985-2017 StataCorp LLC
Statistics/Data Analysis StataCorp
4905 Lakeway Drive
College Station, Texas 77845 USA
800-STATA-PC http://www.stata.com
979-696-4600 stata@stata.com
979-696-4601 (fax)

Single-user Stata perpetual license:


Serial number: 301506215585
Licensed to: www.Downloadly.ir
Iran Will Defeat US

Notes:
1. Unicode is supported; see help unicode_advice.

1 . use "D:\DOCTORADO DEN\3er SEMESTRE\DATOS ´PANEL\EL BUENO\PROYECTO FINAL.dta"

2 . xtline idh, overlay

3 . xtline idh

4 . xtline idh, overlay

5 . xtline idh, overlay

6 . tab año, idh(per)


option idh() not allowed
r(198);

7 . tab año, gen(per)

año Freq. Percent Cum.

2010 32 33.33 33.33


2015 32 33.33 66.67
2020 32 33.33 100.00

Total 96 100.00

8 . reg idh rcog lpib per2 per3, cformat(%9.6f)

Source SS df MS Number of obs = 96


F(4, 91) = 1.55
Model .009726889 4 .002431722 Prob > F = 0.1954
Residual .143068087 91 .001572177 R-squared = 0.0637
Adj R-squared = 0.0225
Total .152794976 95 .001608368 Root MSE = .03965

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

rcog -0.022752 0.026062 -0.87 0.385 -0.074521 0.029017


lpib 0.001788 0.005319 0.34 0.737 -0.008777 0.012354
per2 0.022206 0.010855 2.05 0.044 0.000643 0.043768
per3 0.025309 0.012021 2.11 0.038 0.001430 0.049187
_cons 0.759866 0.097886 7.76 0.000 0.565427 0.954305
Tuesday March 5 19:24:00 2024 Page 2

9 . reg idh rcog lpib per1 per2, cformat(%9.6f)

Source SS df MS Number of obs = 96


F(4, 91) = 1.55
Model .009726889 4 .002431722 Prob > F = 0.1954
Residual .143068087 91 .001572177 R-squared = 0.0637
Adj R-squared = 0.0225
Total .152794976 95 .001608368 Root MSE = .03965

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

rcog -0.022752 0.026062 -0.87 0.385 -0.074521 0.029017


lpib 0.001788 0.005319 0.34 0.737 -0.008777 0.012354
per1 -0.025309 0.012021 -2.11 0.038 -0.049187 -0.001430
per2 -0.003103 0.010203 -0.30 0.762 -0.023371 0.017164
_cons 0.785175 0.103414 7.59 0.000 0.579756 0.990594

10 . reg idh rcog lpib per3, cformat(%9.6f)

Source SS df MS Number of obs = 96


F(3, 92) = 0.65
Model .003148181 3 .001049394 Prob > F = 0.5880
Residual .149646795 92 .001626596 R-squared = 0.0206
Adj R-squared = -0.0113
Total .152794976 95 .001608368 Root MSE = .04033

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

rcog -0.001328 0.024275 -0.05 0.956 -0.049540 0.046883


lpib 0.003718 0.005325 0.70 0.487 -0.006857 0.014293
per3 0.010399 0.009724 1.07 0.288 -0.008912 0.029711
_cons 0.700027 0.095016 7.37 0.000 0.511317 0.888737

11 . save "D:\DOCTORADO DEN\3er SEMESTRE\DATOS ´PANEL\EL BUENO\PROYECTO FINAL.dta", replace


file D:\DOCTORADO DEN\3er SEMESTRE\DATOS ´PANEL\EL BUENO\PROYECTO FINAL.dta saved

12 . xtset id año
panel variable: id (strongly balanced)
time variable: año, 2010 to 2020, but with gaps
delta: 1 unit

13 .
14 . sort id año

15 .
16 . global variables idh rcog lpib

17 .
18 . foreach var of varlist $variables {
2.
19 . gen `var'dif=`var'-L1.`var'
3.
20 . }
(96 missing values generated)
(96 missing values generated)
(96 missing values generated)
Tuesday March 5 19:24:00 2024 Page 3

21 . save "D:\DOCTORADO DEN\3er SEMESTRE\DATOS ´PANEL\EL BUENO\PROYECTO FINAL.dta", replace


file D:\DOCTORADO DEN\3er SEMESTRE\DATOS ´PANEL\EL BUENO\PROYECTO FINAL.dta saved

22 . reg idhdif rcogdif lpibdif,robust cformat(%9.6f)


no observations
r(2000);

23 . reg idhdif rcogdif lpibdif per1 per2 per3,robust cformat(%9.6f)


no observations
r(2000);

24 . reg idhdif rcogdif lpibdif per3,robust cformat(%9.6f)


no observations
r(2000);

25 . reg idhdif rcogdif lpibdif per3, cformat(%9.6f)


no observations
r(2000);

26 . reg idhdif rcogdif lpibdif


no observations
r(2000);

27 . drop idhdif

28 . drop rcogdif

29 . drop lpibdif

30 . xtset id año
panel variable: id (strongly balanced)
time variable: año, 2010 to 2020, but with gaps
delta: 1 unit

31 .
32 . sort id año

33 .
34 . global variables idh cog lpib

35 .
36 . foreach var of varlist $variables {
2.
37 . gen `var'dif=`var'-L1.`var'
3.
38 . }
(96 missing values generated)
(96 missing values generated)
(96 missing values generated)

39 . drop idhdif

40 . drop cogdif

41 . drop lpibdif

42 . xtreg idh rcog lpib , fe

Fixed-effects (within) regression Number of obs = 96


Group variable: id Number of groups = 32

R-sq: Obs per group:


within = 0.5344 min = 3
between = 0.0024 avg = 3.0
overall = 0.0072 max = 3

F(2,62) = 35.58
corr(u_i, Xb) = -0.6686 Prob > F = 0.0000
Tuesday March 5 19:24:00 2024 Page 4

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

rcog .0325972 .0070466 4.63 0.000 .0185112 .0466831


lpib .0494275 .0120121 4.11 0.000 .0254156 .0734394
_cons .044796 .1467175 0.31 0.761 -.2484882 .3380802

sigma_u .0534005
sigma_e .00900484
rho .97235069 (fraction of variance due to u_i)

F test that all u_i=0: F(31, 62) = 58.27 Prob > F = 0.0000

43 . estimate store m1

44 . xtreg idh rcog lpib , re

Random-effects GLS regression Number of obs = 96


Group variable: id Number of groups = 32

R-sq: Obs per group:


within = 0.4959 min = 3
between = 0.0003 avg = 3.0
overall = 0.0084 max = 3

Wald chi2(2) = 55.91


corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000

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

rcog .0397749 .0067355 5.91 0.000 .0265735 .0529762


lpib .0212255 .0074207 2.86 0.004 .0066812 .0357698
_cons .3887611 .0921785 4.22 0.000 .2080947 .5694276

sigma_u .03955091
sigma_e .00900484
rho .95071774 (fraction of variance due to u_i)

45 . estimate store re

46 . hausman m1 re

Coefficients
(b) (B) (b-B) sqrt(diag(V_b-V_B))
m1 re Difference S.E.

rcog .0325972 .0397749 -.0071777 .0020706


lpib .0494275 .0212255 .028202 .0094459

b = consistent under Ho and Ha; obtained from xtreg


B = inconsistent under Ha, efficient under Ho; obtained from xtreg

Test: Ho: difference in coefficients not systematic

chi2(2) = (b-B)'[(V_b-V_B)^(-1)](b-B)
= 8.60
Prob>chi2 = 0.0136
(V_b-V_B is not positive definite)
Tuesday March 5 19:24:00 2024 Page 5

47 . xttest
command xttest is unrecognized
r(199);

48 . xttest0

Breusch and Pagan Lagrangian multiplier test for random effects

idh[id,t] = Xb + u[id] + e[id,t]

Estimated results:
Var sd = sqrt(Var)

idh .0016084 .0401045


e .0000811 .0090048
u .0015643 .0395509

Test: Var(u) = 0
chibar2(01) = 80.22
Prob > chibar2 = 0.0000

49 . xtreg idh rcog lpib, fe robust cformat(%9.6f)

Fixed-effects (within) regression Number of obs = 96


Group variable: id Number of groups = 32

R-sq: Obs per group:


within = 0.5344 min = 3
between = 0.0024 avg = 3.0
overall = 0.0072 max = 3

F(2,31) = 36.09
corr(u_i, Xb) = -0.6686 Prob > F = 0.0000

(Std. Err. adjusted for 32 clusters in id)

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

rcog 0.032597 0.010177 3.20 0.003 0.011841 0.053353


lpib 0.049427 0.018729 2.64 0.013 0.011229 0.087626
_cons 0.044796 0.222247 0.20 0.842 -0.408480 0.498072

sigma_u 0.053400
sigma_e 0.053400
rho 0.972351 (fraction of variance due to u_i)

50 . xtreg idh rcog, fe robust cformat(%9.6f)

Fixed-effects (within) regression Number of obs = 96


Group variable: id Number of groups = 32

R-sq: Obs per group:


within = 0.4073 min = 3
between = 0.0250 avg = 3.0
overall = 0.0010 max = 3

F(1,31) = 34.67
corr(u_i, Xb) = -0.1914 Prob > F = 0.0000
Tuesday March 5 19:24:00 2024 Page 6

(Std. Err. adjusted for 32 clusters in id)

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

rcog 0.046009 0.007813 5.89 0.000 0.030073 0.061944


_cons 0.645790 0.017356 37.21 0.000 0.610392 0.681188

sigma_u 0.040402
sigma_e 0.040402
rho 0.941408 (fraction of variance due to u_i)

51 . xtreg idh lpib, fe robust cformat(%9.6f)

Fixed-effects (within) regression Number of obs = 96


Group variable: id Number of groups = 32

R-sq: Obs per group:


within = 0.3737 min = 3
between = 0.0040 avg = 3.0
overall = 0.0062 max = 3

F(1,31) = 18.76
corr(u_i, Xb) = -0.8241 Prob > F = 0.0001

(Std. Err. adjusted for 32 clusters in id)

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

lpib 0.075130 0.017345 4.33 0.000 0.039754 0.110506


_cons -0.210806 0.221359 -0.95 0.348 -0.662271 0.240660

sigma_u 0.069737
sigma_e 0.069737
rho 0.978404 (fraction of variance due to u_i)

52 . vif
not appropriate after regress, nocons;
use option uncentered to get uncentered VIFs
r(301);

53 . xtreg idh rcog lpib, fe cformat(%9.6f)

Fixed-effects (within) regression Number of obs = 96


Group variable: id Number of groups = 32

R-sq: Obs per group:


within = 0.5344 min = 3
between = 0.0024 avg = 3.0
overall = 0.0072 max = 3

F(2,62) = 35.58
corr(u_i, Xb) = -0.6686 Prob > F = 0.0000

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

rcog 0.032597 0.007047 4.63 0.000 0.018511 0.046683


lpib 0.049427 0.012012 4.11 0.000 0.025416 0.073439
_cons 0.044796 0.146718 0.31 0.761 -0.248488 0.338080

sigma_u 0.053400
sigma_e 0.053400
rho 0.972351 (fraction of variance due to u_i)

F test that all u_i=0: F(31, 62) = 58.27 Prob > F = 0.0000
Tuesday March 5 19:24:00 2024 Page 7

54 . vif
not appropriate after regress, nocons;
use option uncentered to get uncentered VIFs
r(301);

55 . reg idh cog lpib

Source SS df MS Number of obs = 96


F(2, 93) = 0.41
Model .001327657 2 .000663829 Prob > F = 0.6664
Residual .151467319 93 .001628681 R-squared = 0.0087
Adj R-squared = -0.0126
Total .152794976 95 .001608368 Root MSE = .04036

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

cog -.0509079 .104375 -0.49 0.627 -.258176 .1563602


lpib .0044637 .0052944 0.84 0.401 -.0060499 .0149772
_cons .7141196 .0743167 9.61 0.000 .5665412 .8616979

56 . vif

Variable VIF 1/VIF

cog 1.04 0.958646


lpib 1.04 0.958646

Mean VIF 1.04

57 . do "C:\Users\sos_c\AppData\Local\Temp\STD5b2c_000000.tmp"

58 . twoway (scatter idh cog, mlabel(entidadfederativa) mlabsize(vsmall)) (lfit idh cog), by(año)

59 . twoway (scatter idh lpib, mlabel(entidadfederativa) mlabsize(vsmall)) (lfit idh lpib), by(añ

60 .
end of do-file

61 . do "C:\Users\sos_c\AppData\Local\Temp\STD5b2c_000000.tmp"

62 . xtline idh

63 .
end of do-file

64 . do "C:\Users\sos_c\AppData\Local\Temp\STD5b2c_000000.tmp"

65 . xtline idh, overlay

66 .
end of do-file

67 . xtreg idh rcog lpib per1 per2 per3


note: per3 omitted because of collinearity

Random-effects GLS regression Number of obs = 96


Group variable: id Number of groups = 32

R-sq: Obs per group:


within = 0.7446 min = 3
between = 0.0003 avg = 3.0
overall = 0.0489 max = 3

Wald chi2(4) = 176.99


corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000
Tuesday March 5 19:24:00 2024 Page 8

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

rcog .0082516 .0066004 1.25 0.211 -.0046849 .0211881


lpib .0025391 .007039 0.36 0.718 -.011257 .0163352
per1 -.017366 .0025076 -6.93 0.000 -.0222809 -.0124512
per2 -.0002034 .0018076 -0.11 0.910 -.0037463 .0033395
per3 0 (omitted)
_cons .7031133 .0915836 7.68 0.000 .5236128 .8826138

sigma_u .03969873
sigma_e .00677819
rho .97167341 (fraction of variance due to u_i)

68 . xtreg idh rcog lpib per2

Random-effects GLS regression Number of obs = 96


Group variable: id Number of groups = 32

R-sq: Obs per group:


within = 0.5522 min = 3
between = 0.0000 avg = 3.0
overall = 0.0124 max = 3

Wald chi2(3) = 72.72


corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000

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

rcog .0392404 .0063857 6.14 0.000 .0267245 .0517562


lpib .014828 .0074886 1.98 0.048 .0001505 .0295054
per2 .0064028 .0020299 3.15 0.002 .0024243 .0103812
_cons .4694586 .0930741 5.04 0.000 .2870366 .6518806

sigma_u .0395706
sigma_e .00874153
rho .95346958 (fraction of variance due to u_i)

69 . xtreg idh rcog lpib per2, robust

Random-effects GLS regression Number of obs = 96


Group variable: id Number of groups = 32

R-sq: Obs per group:


within = 0.5522 min = 3
between = 0.0000 avg = 3.0
overall = 0.0124 max = 3

Wald chi2(3) = 101.51


corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000

(Std. Err. adjusted for 32 clusters in id)

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

rcog .0392404 .007222 5.43 0.000 .0250854 .0533953


lpib .014828 .0074982 1.98 0.048 .0001318 .0295242
per2 .0064028 .0017162 3.73 0.000 .0030391 .0097665
_cons .4694586 .0871066 5.39 0.000 .2987329 .6401843

sigma_u .0395706
sigma_e .00874153
rho .95346958 (fraction of variance due to u_i)
Tuesday March 5 19:24:00 2024 Page 9

70 . xtreg idh rcog lpib per2, fe robust

Fixed-effects (within) regression Number of obs = 96


Group variable: id Number of groups = 32

R-sq: Obs per group:


within = 0.5683 min = 3
between = 0.0017 avg = 3.0
overall = 0.0091 max = 3

F(3,31) = 33.21
corr(u_i, Xb) = -0.5221 Prob > F = 0.0000

(Std. Err. adjusted for 32 clusters in id)

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

rcog .0348559 .0094154 3.70 0.001 .015653 .0540587


lpib .0352523 .0210304 1.68 0.104 -.0076395 .0781441
per2 .0047645 .0023752 2.01 0.054 -.0000797 .0096087
_cons .219092 .2525859 0.87 0.392 -.2960604 .7342444

sigma_u .04657589
sigma_e .00874153
rho .96597343 (fraction of variance due to u_i)

71 . xtreg idh rcog lpib per2, re robust

Random-effects GLS regression Number of obs = 96


Group variable: id Number of groups = 32

R-sq: Obs per group:


within = 0.5522 min = 3
between = 0.0000 avg = 3.0
overall = 0.0124 max = 3

Wald chi2(3) = 101.51


corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000

(Std. Err. adjusted for 32 clusters in id)

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

rcog .0392404 .007222 5.43 0.000 .0250854 .0533953


lpib .014828 .0074982 1.98 0.048 .0001318 .0295242
per2 .0064028 .0017162 3.73 0.000 .0030391 .0097665
_cons .4694586 .0871066 5.39 0.000 .2987329 .6401843

sigma_u .0395706
sigma_e .00874153
rho .95346958 (fraction of variance due to u_i)

72 . drop _est_m1

73 . drop _est_re
Tuesday March 5 19:24:00 2024 Page 10

74 . xtreg idh rcog lpib per2, fe

Fixed-effects (within) regression Number of obs = 96


Group variable: id Number of groups = 32

R-sq: Obs per group:


within = 0.5683 min = 3
between = 0.0017 avg = 3.0
overall = 0.0091 max = 3

F(3,61) = 26.77
corr(u_i, Xb) = -0.5221 Prob > F = 0.0000

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

rcog .0348559 .0069179 5.04 0.000 .0210226 .0486892


lpib .0352523 .0133384 2.64 0.010 .0085804 .0619241
per2 .0047645 .0021767 2.19 0.032 .000412 .009117
_cons .219092 .163175 1.34 0.184 -.1071966 .5453806

sigma_u .04657589
sigma_e .00874153
rho .96597343 (fraction of variance due to u_i)

F test that all u_i=0: F(31, 61) = 61.37 Prob > F = 0.0000

75 . estimate store fe

76 . xtreg idh rcog lpib per2, re

Random-effects GLS regression Number of obs = 96


Group variable: id Number of groups = 32

R-sq: Obs per group:


within = 0.5522 min = 3
between = 0.0000 avg = 3.0
overall = 0.0124 max = 3

Wald chi2(3) = 72.72


corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000

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

rcog .0392404 .0063857 6.14 0.000 .0267245 .0517562


lpib .014828 .0074886 1.98 0.048 .0001505 .0295054
per2 .0064028 .0020299 3.15 0.002 .0024243 .0103812
_cons .4694586 .0930741 5.04 0.000 .2870366 .6518806

sigma_u .0395706
sigma_e .00874153
rho .95346958 (fraction of variance due to u_i)

77 . estimate store re

78 . hausman fe re

Coefficients
(b) (B) (b-B) sqrt(diag(V_b-V_B))
fe re Difference S.E.

rcog .0348559 .0392404 -.0043845 .0026609


lpib .0352523 .014828 .0204243 .0110379
per2 .0047645 .0064028 -.0016383 .0007858

b = consistent under Ho and Ha; obtained from xtreg


B = inconsistent under Ha, efficient under Ho; obtained from xtreg

Test: Ho: difference in coefficients not systematic


Tuesday March 5 19:24:01 2024 Page 11

chi2(3) = (b-B)'[(V_b-V_B)^(-1)](b-B)
= 2.67
Prob>chi2 = 0.4456
(V_b-V_B is not positive definite)

79 . xtreg idh rcog lpib per2, re robust

Random-effects GLS regression Number of obs = 96


Group variable: id Number of groups = 32

R-sq: Obs per group:


within = 0.5522 min = 3
between = 0.0000 avg = 3.0
overall = 0.0124 max = 3

Wald chi2(3) = 101.51


corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000

(Std. Err. adjusted for 32 clusters in id)

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

rcog .0392404 .007222 5.43 0.000 .0250854 .0533953


lpib .014828 .0074982 1.98 0.048 .0001318 .0295242
per2 .0064028 .0017162 3.73 0.000 .0030391 .0097665
_cons .4694586 .0871066 5.39 0.000 .2987329 .6401843

sigma_u .0395706
sigma_e .00874153
rho .95346958 (fraction of variance due to u_i)

80 . xtsum idh rcog lpib

Variable Mean Std. Dev. Min Max Observations

idh overall .7479896 .0401045 .63 .836 N = 96


between .0390749 .6463333 .825 n = 32
within .0106613 .7249896 .7659896 T = 3

rcog overall 2.2213 .193549 1.694915 2.688172 N = 96


between .1262068 1.966916 2.524253 n = 32
within .1478797 1.802248 2.571428 T = 3

lpib overall 12.76184 .7987554 11.31438 14.86975 N = 96


between .8025231 11.43023 14.81512 n = 32
within .0867498 12.51941 12.96688 T = 3

81 .
82 .
83 . save "D:\DOCTORADO DEN\3er SEMESTRE\DATOS ´PANEL\EL BUENO\PROYECTO FINAL.dta", replace
file D:\DOCTORADO DEN\3er SEMESTRE\DATOS ´PANEL\EL BUENO\PROYECTO FINAL.dta saved

84 . log using "D:\DOCTORADO DEN\3er SEMESTRE\DATOS ´PANEL\ejemplo.log"

name: <unnamed>
log: D:\DOCTORADO DEN\3er SEMESTRE\DATOS ´PANEL\ejemplo.log
log type: text
opened on: 5 Mar 2024, 19:21:37

85 .

You might also like