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

dec25 Thursday February 22 11:28:21 2024 Page 1

___ ____ ____ ____ ____(R)


/__ / ____/ / ____/
___/ / /___/ / /___/
Statistics/Data analysis

___ ____ ____ ____ ____ ©


/__ / ____/ / ____/ 17.0
___/ / /___/ / /___/ MP—Parallel Edition

Statistics and Data Science Copyright 1985-2021 StataCorp LLC


StataCorp
4905 Lakeway Drive
College Station, Texas 77845 USA
800-STATA-PC https://www.stata.com
979-696-4600 stata@stata.com

Stata license: Unlimited-user 64-core network perpetual


Serial number: 18461036
Licensed to: TEAM BTCR
TEAM BTCR

Notes:
1. Unicode is supported; see help unicode_advice.
2. More than 2 billion observations are allowed; see help obs_advice.
3. Maximum number of variables is set to 5,000; see help set_maxvar.
4. New update available; type -update all-

1 . use "C:\Users\Issay\Desktop\exam.dta"

2 . do "C:\Users\Issay\Desktop\stata_panel\do.projet.do"

3 . *calcul de SCR1 non contraint estimation equation par equation


4 . set more off

5 . local SCR1=0

6 . scalar N=3

7 . scalar T=20

8 . scalar k=1

9 . forvalues i == 1/3 {
2. reg y x if country == `i'
3. local SCR1=`SCR1'+e(rss)
4. }

Source SS df MS Number of obs = 20


F(1, 18) = 13.30
Model 29.6496894 1 29.6496894 Prob > F = 0.0018
Residual 40.1398106 18 2.22998948 R-squared = 0.4248
Adj R-squared = 0.3929
Total 69.7895 19 3.67313158 Root MSE = 1.4933

y Coefficient Std. err. t P>|t| [95% conf. interval]

x -.0465907 .0127774 -3.65 0.002 -.073435 -.0197465


_cons 12.55426 .9902337 12.68 0.000 10.47386 14.63466

Source SS df MS Number of obs = 20


F(1, 18) = 0.09
Model .233723186 1 .233723186 Prob > F = 0.7716
Residual 48.4582782 18 2.69212656 R-squared = 0.0048
Adj R-squared = -0.0505
Total 48.6920014 19 2.56273691 Root MSE = 1.6408

y Coefficient Std. err. t P>|t| [95% conf. interval]

x -.0065804 .0223332 -0.29 0.772 -.0535006 .0403398


_cons 9.342452 1.810701 5.16 0.000 5.538311 13.14659
dec25 Thursday February 22 11:28:22 2024 Page 2

Source SS df MS Number of obs = 20


F(1, 18) = 21.31
Model 23.1677281 1 23.1677281 Prob > F = 0.0002
Residual 19.5722722 18 1.08734846 R-squared = 0.5421
Adj R-squared = 0.5166
Total 42.7400003 19 2.2494737 Root MSE = 1.0428

y Coefficient Std. err. t P>|t| [95% conf. interval]

x -.0560636 .0121457 -4.62 0.000 -.0815809 -.0305464


_cons 11.52442 1.113194 10.35 0.000 9.185687 13.86316

10 . display %12.2f `SCR1'


108.17

11 .
end of do-file

12 . regress y x

Source SS df MS Number of obs = 60


F(1, 58) = 29.42
Model 82.4039428 1 82.4039428 Prob > F = 0.0000
Residual 162.441891 58 2.80072226 R-squared = 0.3366
Adj R-squared = 0.3251
Total 244.845834 59 4.14992939 Root MSE = 1.6735

y Coefficient Std. err. t P>|t| [95% conf. interval]

x -.0530767 .0097851 -5.42 0.000 -.0726637 -.0334897


_cons 12.43941 .8182869 15.20 0.000 10.80143 14.07739

13 . xtset country years

Panel variable: country (strongly balanced)


Time variable: years, 1980 to 1999
Delta: 1 unit

14 . xtreg y x,fe

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


Group variable: country Number of groups = 3

R-squared: Obs per group:


Within = 0.2764 min = 20
Between = 0.9253 avg = 20.0
Overall = 0.3366 max = 20

F(1,56) = 21.39
corr(u_i, Xb) = 0.2906 Prob > F = 0.0000

y Coefficient Std. err. t P>|t| [95% conf. interval]

x -.0410612 .0088786 -4.62 0.000 -.0588472 -.0232751


_cons 11.47026 .739982 15.50 0.000 9.987895 12.95262

sigma_u 1.118042
sigma_e 1.4433607
rho .37500825 (fraction of variance due to u_i)

F test that all u_i=0: F(2, 56) = 10.99 Prob > F = 0.0001
dec25 Thursday February 22 11:28:22 2024 Page 3

15 . xtreg y x i.country

Random-effects GLS regression Number of obs = 60


Group variable: country Number of groups = 3

R-squared: Obs per group:


Within = 0.2764 min = 20
Between = 1.0000 avg = 20.0
Overall = 0.5235 max = 20

Wald chi2(3) = 61.53


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

y Coefficient Std. err. z P>|z| [95% conf. interval]

x -.0410612 .0088786 -4.62 0.000 -.058463 -.0236593

country
can -.0707716 .4599927 -0.15 0.878 -.9723408 .8307976
usa -1.970921 .4798008 -4.11 0.000 -2.911314 -1.030529

_cons 12.15082 .7237342 16.79 0.000 10.73233 13.56931

sigma_u 0
sigma_e 1.4433607
rho 0 (fraction of variance due to u_i)

16 . tabulate country,gen(dum)

country Freq. Percent Cum.

RU 20 33.33 33.33
can 20 33.33 66.67
usa 20 33.33 100.00

Total 60 100.00

17 . regress x y dum1 dum2 dum3,noconstant

Source SS df MS Number of obs = 60


F(4, 56) = 293.18
Model 400473.288 4 100118.322 Prob > F = 0.0000
Residual 19123.6613 56 341.493951 R-squared = 0.9544
Adj R-squared = 0.9512
Total 419596.949 60 6993.28248 Root MSE = 18.48

x Coefficient Std. err. t P>|t| [95% conf. interval]

y -6.730765 1.455392 -4.62 0.000 -9.646265 -3.815264


dum1 134.5802 13.95015 9.65 0.000 106.6346 162.5257
dum2 138.7603 13.48525 10.29 0.000 111.7461 165.7745
dum3 133.37 10.32314 12.92 0.000 112.6902 154.0497

18 . regress x y,re
option re not allowed
r(198);
dec25 Thursday February 22 11:28:23 2024 Page 4

19 . xtreg x y,re

Random-effects GLS regression Number of obs = 60


Group variable: country Number of groups = 3

R-squared: Obs per group:


Within = 0.2764 min = 20
Between = 0.9253 avg = 20.0
Overall = 0.3366 max = 20

Wald chi2(1) = 29.42


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

x Coefficient Std. err. z P>|z| [95% conf. interval]

y -6.340905 1.168994 -5.42 0.000 -8.632091 -4.049719


_cons 132.3895 9.825056 13.47 0.000 113.1328 151.6463

sigma_u 0
sigma_e 18.479555
rho 0 (fraction of variance due to u_i)

20 . xtreg y x,fe

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


Group variable: country Number of groups = 3

R-squared: Obs per group:


Within = 0.2764 min = 20
Between = 0.9253 avg = 20.0
Overall = 0.3366 max = 20

F(1,56) = 21.39
corr(u_i, Xb) = 0.2906 Prob > F = 0.0000

y Coefficient Std. err. t P>|t| [95% conf. interval]

x -.0410612 .0088786 -4.62 0.000 -.0588472 -.0232751


_cons 11.47026 .739982 15.50 0.000 9.987895 12.95262

sigma_u 1.118042
sigma_e 1.4433607
rho .37500825 (fraction of variance due to u_i)

F test that all u_i=0: F(2, 56) = 10.99 Prob > F = 0.0001

21 . est store fe

22 . xtreg x y,re

Random-effects GLS regression Number of obs = 60


Group variable: country Number of groups = 3

R-squared: Obs per group:


Within = 0.2764 min = 20
Between = 0.9253 avg = 20.0
Overall = 0.3366 max = 20

Wald chi2(1) = 29.42


corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000
dec25 Thursday February 22 11:28:24 2024 Page 5

x Coefficient Std. err. z P>|z| [95% conf. interval]

y -6.340905 1.168994 -5.42 0.000 -8.632091 -4.049719


_cons 132.3895 9.825056 13.47 0.000 113.1328 151.6463

sigma_u 0
sigma_e 18.479555
rho 0 (fraction of variance due to u_i)

23 . est store re

24 . hausman fe re,sigmamore
no coefficients in common; specify equations(matchlist)
for problems with different equation names.
r(498);

25 . drop _est_fe _est_re

26 . xtreg y x,fe

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


Group variable: country Number of groups = 3

R-squared: Obs per group:


Within = 0.2764 min = 20
Between = 0.9253 avg = 20.0
Overall = 0.3366 max = 20

F(1,56) = 21.39
corr(u_i, Xb) = 0.2906 Prob > F = 0.0000

y Coefficient Std. err. t P>|t| [95% conf. interval]

x -.0410612 .0088786 -4.62 0.000 -.0588472 -.0232751


_cons 11.47026 .739982 15.50 0.000 9.987895 12.95262

sigma_u 1.118042
sigma_e 1.4433607
rho .37500825 (fraction of variance due to u_i)

F test that all u_i=0: F(2, 56) = 10.99 Prob > F = 0.0001

27 . est store fe

28 . xtreg x y,re

Random-effects GLS regression Number of obs = 60


Group variable: country Number of groups = 3

R-squared: Obs per group:


Within = 0.2764 min = 20
Between = 0.9253 avg = 20.0
Overall = 0.3366 max = 20

Wald chi2(1) = 29.42


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

x Coefficient Std. err. z P>|z| [95% conf. interval]

y -6.340905 1.168994 -5.42 0.000 -8.632091 -4.049719


_cons 132.3895 9.825056 13.47 0.000 113.1328 151.6463

sigma_u 0
sigma_e 18.479555
rho 0 (fraction of variance due to u_i)
dec25 Thursday February 22 11:28:24 2024 Page 6

29 . est store re

30 . hausman fe re,sigmamore
no coefficients in common; specify equations(matchlist)
for problems with different equation names.
r(498);

31 . hausman fe re
no coefficients in common; specify equations(matchlist)
for problems with different equation names.
r(498);

32 . hausman _est_fe _est_re ,sigmamore


estimation result _est_fe not found
r(111);

33 . drop _est_fe _est_re

34 .

You might also like