___ ____ ____ ____ ____(R)
/__ / ____/ / ____/
___/ / /___/ / /___/
Statistics/Data Analysis
1 .
name: <unnamed>
log: C:\Users\DELL\OneDrive\Desktop\Final Estimations.smcl
log type: smcl
opened on: 10 May 2025, 11:53:17
2 . gen ln_gdpperpremp = log(gdpperpremp)
(1 missing value generated)
3 .
4 . encode country, gen(countryA)
5 .
6 . xtset countryA year
panel variable: countryA (strongly balanced)
time variable: year, 2002 to 2022
delta: 1 unit
7 .
8 . summ
Variable Obs Mean Std. Dev. Min Max
country 0
year 147 2012 6.076003 2002 2022
urbanpopul~h 147 2.908293 1.305388 -2.788711 6.238845
popgrwan 147 1.460068 .8612857 .11 4.42
gdpperpremp 146 24893.65 27916.52 6706.93 97218.62
unemprtan 147 5.97966 3.106794 .4 13.12
ln_gdpperp~p 146 9.754641 .7431995 8.810897 11.48472
countryA 147 4 2.006838 1 7
9 .
10 . *********CHECKING FOR MULTICOLINEARITY*********
11 .
12 . pwcorr urbanpopulationgrowth popgrwan gdpperpremp unemprtan
urbanp~h popgrwan gdpper~p unempr~n
urbanpopul~h 1.0000
popgrwan 0.6173 1.0000
gdpperpremp -0.6975 -0.3603 1.0000
unemprtan -0.0133 -0.0226 -0.0792 1.0000
13 .
14 . *********REGRESSION*****************
15 .
16 . xtreg urbanpopulationgrowth popgrwan ln_gdpperpremp unemprtan
Random-effects GLS regression Number of obs = 146
Group variable: countryA Number of groups = 7
R-sq: within = 0.4901 Obs per group: min = 20
between = 0.6815 avg = 20.9
overall = 0.6186 max = 21
Wald chi2(3) = 138.84
corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000
urbanpopul~h Coef. Std. Err. z P>|z| [95% Conf. Interval]
popgrwan .4253785 .0794597 5.35 0.000 .2696403 .5811166
ln_gdpperp~p -1.539514 .1794397 -8.58 0.000 -1.891209 -1.187819
unemprtan -.0515028 .029473 -1.75 0.081 -.1092687 .0062632
_cons 17.61953 1.803264 9.77 0.000 14.0852 21.15386
sigma_u .82673634
sigma_e .51571302
rho .71988087 (fraction of variance due to u_i)
17 .
18 . ************ Fixed Vs Pool**************
19 .
20 . xtreg urbanpopulationgrowth popgrwan ln_gdpperpremp unemprtan, fe
Fixed-effects (within) regression Number of obs = 146
Group variable: countryA Number of groups = 7
R-sq: within = 0.4906 Obs per group: min = 20
between = 0.6754 avg = 20.9
overall = 0.6133 max = 21
F(3,136) = 43.65
corr(u_i, Xb) = -0.4882 Prob > F = 0.0000
urbanpopul~h Coef. Std. Err. t P>|t| [95% Conf. Interval]
popgrwan .4142253 .0808522 5.12 0.000 .254335 .5741155
ln_gdpperp~p -1.635437 .1953441 -8.37 0.000 -2.021742 -1.249132
unemprtan -.051436 .0306965 -1.68 0.096 -.1121401 .0092682
_cons 18.56621 1.926979 9.63 0.000 14.7555 22.37693
sigma_u .79273569
sigma_e .51571302
rho .70263534 (fraction of variance due to u_i)
F test that all u_i=0: F(6, 136) = 31.11 Prob > F = 0.0000
21 .
22 . *H0:Pool Ols is prefereed
23 .
24 . *H1: Fixed Effect will be prefered
25 .
26 . *since the p value (0.0000) is less than 0.05 we reject H0, and fixed effect
> model would be prefered.
27 .
28 . **********Random Vs Pool***********
29 .
30 . xtreg urbanpopulationgrowth popgrwan unemprtan ln_gdpperpremp, re
Random-effects GLS regression Number of obs = 146
Group variable: countryA Number of groups = 7
R-sq: within = 0.4901 Obs per group: min = 20
between = 0.6815 avg = 20.9
overall = 0.6186 max = 21
Wald chi2(3) = 138.84
corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000
urbanpopul~h Coef. Std. Err. z P>|z| [95% Conf. Interval]
popgrwan .4253785 .0794597 5.35 0.000 .2696403 .5811166
unemprtan -.0515028 .029473 -1.75 0.081 -.1092687 .0062632
ln_gdpperp~p -1.539514 .1794397 -8.58 0.000 -1.891209 -1.187819
_cons 17.61953 1.803264 9.77 0.000 14.0852 21.15386
sigma_u .82673634
sigma_e .51571302
rho .71988087 (fraction of variance due to u_i)
31 .
32 . *ho: Pooled Ols will be prefered
33 .
34 . *h1: Random effects model will be prefered
35 .
36 . ******* since p value (0.0000) is less then 0.05 we reject H0, random effects
> model will be prefered.
37 .
38 . *********choosing btw fixed vs random model
39 .
40 . xtreg urbanpopulationgrowth popgrwan ln_gdpperpremp unemprtan, fe
Fixed-effects (within) regression Number of obs = 146
Group variable: countryA Number of groups = 7
R-sq: within = 0.4906 Obs per group: min = 20
between = 0.6754 avg = 20.9
overall = 0.6133 max = 21
F(3,136) = 43.65
corr(u_i, Xb) = -0.4882 Prob > F = 0.0000
urbanpopul~h Coef. Std. Err. t P>|t| [95% Conf. Interval]
popgrwan .4142253 .0808522 5.12 0.000 .254335 .5741155
ln_gdpperp~p -1.635437 .1953441 -8.37 0.000 -2.021742 -1.249132
unemprtan -.051436 .0306965 -1.68 0.096 -.1121401 .0092682
_cons 18.56621 1.926979 9.63 0.000 14.7555 22.37693
sigma_u .79273569
sigma_e .51571302
rho .70263534 (fraction of variance due to u_i)
F test that all u_i=0: F(6, 136) = 31.11 Prob > F = 0.0000
41 .
42 . estimates store fixed
43 .
44 . xtreg urbanpopulationgrowth popgrwan ln_gdpperpremp unemprtan, re
Random-effects GLS regression Number of obs = 146
Group variable: countryA Number of groups = 7
R-sq: within = 0.4901 Obs per group: min = 20
between = 0.6815 avg = 20.9
overall = 0.6186 max = 21
Wald chi2(3) = 138.84
corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000
urbanpopul~h Coef. Std. Err. z P>|z| [95% Conf. Interval]
popgrwan .4253785 .0794597 5.35 0.000 .2696403 .5811166
ln_gdpperp~p -1.539514 .1794397 -8.58 0.000 -1.891209 -1.187819
unemprtan -.0515028 .029473 -1.75 0.081 -.1092687 .0062632
_cons 17.61953 1.803264 9.77 0.000 14.0852 21.15386
sigma_u .82673634
sigma_e .51571302
rho .71988087 (fraction of variance due to u_i)
45 .
46 . estimates store random
47 .
48 . hausman fixed random
Coefficients
(b) (B) (b-B) sqrt(diag(V_b-V_B))
fixed random Difference S.E.
popgrwan .4142253 .4253785 -.0111532 .0149413
ln_gdpperp~p -1.635437 -1.539514 -.0959232 .0772057
unemprtan -.051436 -.0515028 .0000668 .0085801
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(3) = (b-B)'[(V_b-V_B)^(-1)](b-B)
= 1.95
Prob>chi2 = 0.5834
49 .
50 . *ho: random , h1: fixed
51 .
52 . *since the p value (0.5834) > 0.05 we fail to reject H0 and we use random ef
> fects model.
53 .
54 . **********choosing btw random vs pool**********
55 .
56 . **********POST ESTIMATIONS***********
57 .
58 . *check for hetroskedasticity
59 .
60 . xtreg urbanpopulationgrowth popgrwan unemprtan ln_gdpperpremp, re
Random-effects GLS regression Number of obs = 146
Group variable: countryA Number of groups = 7
R-sq: within = 0.4901 Obs per group: min = 20
between = 0.6815 avg = 20.9
overall = 0.6186 max = 21
Wald chi2(3) = 138.84
corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000
urbanpopul~h Coef. Std. Err. z P>|z| [95% Conf. Interval]
popgrwan .4253785 .0794597 5.35 0.000 .2696403 .5811166
unemprtan -.0515028 .029473 -1.75 0.081 -.1092687 .0062632
ln_gdpperp~p -1.539514 .1794397 -8.58 0.000 -1.891209 -1.187819
_cons 17.61953 1.803264 9.77 0.000 14.0852 21.15386
sigma_u .82673634
sigma_e .51571302
rho .71988087 (fraction of variance due to u_i)
61 .
62 . xttest0
Breusch and Pagan Lagrangian multiplier test for random effects
urbanpopulationgrowth[countryA,t] = Xb + u[countryA] + e[countryA,t]
Estimated results:
Var sd = sqrt(Var)
urbanpo~h 1.712936 1.308792
e .2659599 .515713
u .683493 .8267363
Test: Var(u) = 0
chibar2(01) = 358.65
Prob > chibar2 = 0.0000
63 .
64 . *Ho: Homoskedasticity
65 .
66 . *H1: Hetroskedasticity
67 .
68 . *since p value (0.0000) < level of significance (0.05) we reject Ho, there is
> hetroskedasticity in model.
69 .
70 . ***correction of hetroskedasticity*****
71 .
72 . xtreg urbanpopulationgrowth popgrwan unemprtan ln_gdpperpremp, re robust
Random-effects GLS regression Number of obs = 146
Group variable: countryA Number of groups = 7
R-sq: within = 0.4901 Obs per group: min = 20
between = 0.6815 avg = 20.9
overall = 0.6186 max = 21
Wald chi2(3) = 21.56
corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0001
(Std. Err. adjusted for 7 clusters in countryA)
Robust
urbanpopul~h Coef. Std. Err. z P>|z| [95% Conf. Interval]
popgrwan .4253785 .2399648 1.77 0.076 -.0449439 .8957008
unemprtan -.0515028 .0459794 -1.12 0.263 -.1416207 .0386152
ln_gdpperp~p -1.539514 .4744113 -3.25 0.001 -2.469343 -.609685
_cons 17.61953 5.060722 3.48 0.000 7.700697 27.53836
sigma_u .82673634
sigma_e .51571302
rho .71988087 (fraction of variance due to u_i)
73 .
74 . ***checking for serial corelation in model
75 .
76 . xtserial urbanpopulationgrowth popgrwan ln_gdpperpremp unemprtan
Wooldridge test for autocorrelation in panel data
H0: no first order autocorrelation
F( 1, 6) = 1.104
Prob > F = 0.3339
77 .
78 . *Ho: no serial corelation , H1= serial corelation
79 .
80 . *since p value (0.3339) > level of significance (0.05) we fail to reject Ho,
81 .
82 . **there is no serial corelation in model.
83 .
84 . **************cluster test*********
85 .
86 . xtreg urbanpopulationgrowth popgrwan ln_gdpperpremp unemprtan, re vce (cluste
> r countryA)
Random-effects GLS regression Number of obs = 146
Group variable: countryA Number of groups = 7
R-sq: within = 0.4901 Obs per group: min = 20
between = 0.6815 avg = 20.9
overall = 0.6186 max = 21
Wald chi2(3) = 21.56
corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0001
(Std. Err. adjusted for 7 clusters in countryA)
Robust
urbanpopul~h Coef. Std. Err. z P>|z| [95% Conf. Interval]
popgrwan .4253785 .2399648 1.77 0.076 -.0449439 .8957008
ln_gdpperp~p -1.539514 .4744113 -3.25 0.001 -2.469343 -.609685
unemprtan -.0515028 .0459794 -1.12 0.263 -.1416207 .0386152
_cons 17.61953 5.060722 3.48 0.000 7.700697 27.53836
sigma_u .82673634
sigma_e .51571302
rho .71988087 (fraction of variance due to u_i)
87 . log close
name: <unnamed>
log: C:\Users\DELL\OneDrive\Desktop\Final Estimations.smcl
log type: smcl
closed on: 10 May 2025, 11:54:05