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

td variation finale EFFET FIXE Thursday November 17 11:42:46 2022 Page 1

___ ____ ____ ____ ____(R)


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

___ ____ ____ ____ ____ (R)


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

Single-user 2-core Stata perpetual license:


Serial number: 501606203204
Licensed to: Juan Palomino
Juan Palomino

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 5000; see help set_maxvar.
4. New update available; type -update all-

1 . import excel "C:\Users\acer\Desktop\Mr hefnaoui\td_classe_variation_panel.xlsx", sheet("Feuil2") firstrow


(4 vars, 40 obs)

2 . browse

3 . reg Y X

Source SS df MS Number of obs = 40


F(1, 38) = 95.21
Model 4607.44537 1 4607.44537 Prob > F = 0.0000
Residual 1838.98022 38 48.3942164 R-squared = 0.7147
Adj R-squared = 0.7072
Total 6446.42559 39 165.292964 Root MSE = 6.9566

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

X 1.131589 .1159726 9.76 0.000 .8968151 1.366364


_cons 7.385193 3.502893 2.11 0.042 .2939576 14.47643

4 . tabulate i , generate (Z)

individus Freq. Percent Cum.

1 10 25.00 25.00
2 10 25.00 50.00
3 10 25.00 75.00
4 10 25.00 100.00

Total 40 100.00

5 . reg Y X Z1 Z2 Z3 Z4 ,noconstant

Source SS df MS Number of obs = 40


F(5, 35) = 988.87
Model 69429.629 5 13885.9258 Prob > F = 0.0000
Residual 491.478967 35 14.0422562 R-squared = 0.9930
Adj R-squared = 0.9920
Total 69921.108 40 1748.0277 Root MSE = 3.7473
td variation finale EFFET FIXE Thursday November 17 11:42:47 2022 Page 2

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

X 1.119029 .0635699 17.60 0.000 .989975 1.248082


Z1 2.31501 2.278082 1.02 0.317 -2.309744 6.939763
Z2 10.10964 2.230549 4.53 0.000 5.581381 14.63789
Z3 2.385445 2.031037 1.17 0.248 -1.737779 6.508669
Z4 16.17149 2.160928 7.48 0.000 11.78458 20.55841

6 . reg Y X Z2 Z3 Z4

Source SS df MS Number of obs = 40


F(4, 35) = 106.02
Model 5954.94662 4 1488.73666 Prob > F = 0.0000
Residual 491.478967 35 14.0422562 R-squared = 0.9238
Adj R-squared = 0.9150
Total 6446.42559 39 165.292964 Root MSE = 3.7473

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

X 1.119029 .0635699 17.60 0.000 .989975 1.248082


Z2 7.794626 1.676775 4.65 0.000 4.390592 11.19866
Z3 .0704354 1.701802 0.04 0.967 -3.384407 3.525278
Z4 13.85648 1.681564 8.24 0.000 10.44273 17.27024
_cons 2.31501 2.278082 1.02 0.317 -2.309744 6.939763

7 . xi:reg Y X i.individus
i.individus _Iindividus_1-4 (naturally coded; _Iindividus_1 omitted)

Source SS df MS Number of obs = 40


F(4, 35) = 106.02
Model 5954.94662 4 1488.73666 Prob > F = 0.0000
Residual 491.478967 35 14.0422562 R-squared = 0.9238
Adj R-squared = 0.9150
Total 6446.42559 39 165.292964 Root MSE = 3.7473

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

X 1.119029 .0635699 17.60 0.000 .989975 1.248082


_Iindividus_2 7.794626 1.676775 4.65 0.000 4.390592 11.19866
_Iindividus_3 .0704354 1.701802 0.04 0.967 -3.384407 3.525278
_Iindividus_4 13.85648 1.681564 8.24 0.000 10.44273 17.27024
_cons 2.31501 2.278082 1.02 0.317 -2.309744 6.939763

8 . xtset individus temps


panel variable: individus (strongly balanced)
time variable: temps, 1 to 10
delta: 1 unit

9 . xtreg Y X,fe

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


Group variable: individus Number of groups = 4

R-sq: Obs per group:


within = 0.8985 min = 10
between = 0.1697 avg = 10.0
overall = 0.7147 max = 10

F(1,35) = 309.87
corr(u_i, Xb) = 0.0205 Prob > F = 0.0000
td variation finale EFFET FIXE Thursday November 17 11:42:47 2022 Page 3

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

X 1.119029 .0635699 17.60 0.000 .989975 1.248082


_cons 7.745396 1.916847 4.04 0.000 3.85399 11.6368

sigma_u 6.7034045
sigma_e 3.7472999
rho .76190642 (fraction of variance due to u_i)

F test that all u_i=0: F(3, 35) = 31.99 Prob > F = 0.0000

10 . egen m_y=mean(Y),by(individus)

11 . gen d_y=Y-m_y

12 . egen m_x=mean(X),by(individus)

13 . gen d_x=X-m_x

14 . areg Y X,absorb(i)

Linear regression, absorbing indicators Number of obs = 40


Absorbed variable: individus No. of categories = 4
F( 1, 35) = 309.87
Prob > F = 0.0000
R-squared = 0.9238
Adj R-squared = 0.9150
Root MSE = 3.7473

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

X 1.119029 .0635699 17.60 0.000 .989975 1.248082


_cons 7.745396 1.916847 4.04 0.000 3.85399 11.6368

F test of absorbed indicators: F(3, 35) = 31.987 Prob > F = 0.000

15 . reg d_y d_x,noconstant

Source SS df MS Number of obs = 40


F(1, 39) = 345.28
Model 4351.27738 1 4351.27738 Prob > F = 0.0000
Residual 491.478956 39 12.6020245 R-squared = 0.8985
Adj R-squared = 0.8959
Total 4842.75634 40 121.068908 Root MSE = 3.5499

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

d_x 1.119029 .0602217 18.58 0.000 .9972188 1.240839

16 . * Calcul de SCR1 non contraint: Estimation équation par équation

17 .
18 . set more off

19 .
20 . local SCR1=0
td variation finale EFFET FIXE Thursday November 17 11:42:47 2022 Page 4

21 .
22 . scalar N=4

23 .
24 . scalar T=10

25 .
26 . scalar K=1

27 .
28 . forvalues individus=1/4 {
2.
29 . qui reg Y X if i==`individus'
3.
30 . local SCR1=`SCR1'+e(rss)
4.
31 . }

32 .
33 . di `SCR1'
481.18038

34 .
35 .
36 .
37 . * Calcul de SCR1C contraint: Estimation sur le modèle empilé

38 .
39 . qui reg Y X

40 .
41 .
42 .
43 . local SCR1C=e(rss)

44 .
45 . di `SCR1C'
1838.9802

46 .
47 .
48 .
49 . *Calcul de la statistique de Fisher F1 N=33 T=15 K=5

50 .
51 . local F1=((`SCR1C'-`SCR1')*(N*T-N*(K+1)))/(`SCR1'*(N-1)*(K+1))

52 .
53 . *La P_value de F1

54 .
55 . di "dof1 = " (N-1)*(K+1) " dof2 = " (N*T-N*(K+1))
dof1 = 6 dof2 = 32

56 .
57 . local PVF1=Ftail((K+1)*(N-1),(N*T-N*(K+1)),`F1')

58 .
59 .
60 .
td variation finale EFFET FIXE Thursday November 17 11:42:47 2022 Page 5

61 . * Calcul de SCR1CP: estimation du modèle à effets individuels

62 .
63 . xtreg Y X,fe

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


Group variable: individus Number of groups = 4

R-sq: Obs per group:


within = 0.8985 min = 10
between = 0.1697 avg = 10.0
overall = 0.7147 max = 10

F(1,35) = 309.87
corr(u_i, Xb) = 0.0205 Prob > F = 0.0000

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

X 1.119029 .0635699 17.60 0.000 .989975 1.248082


_cons 7.745396 1.916847 4.04 0.000 3.85399 11.6368

sigma_u 6.7034045
sigma_e 3.7472999
rho .76190642 (fraction of variance due to u_i)

F test that all u_i=0: F(3, 35) = 31.99 Prob > F = 0.0000

64 .
65 .
66 .
67 . local SCR1CP=e(rss)

68 .
69 . di `SCR1CP'
491.47897

70 .
71 . *Calcul de la statistique de Fisher F2

72 .
73 . local F2=((`SCR1CP'-`SCR1')*(N*T-N*(K+1)))/(`SCR1'*(N-1)*K)

74 .
75 .
76 .
77 . *La P_value de F2

78 .
79 . di "dof1 = " K*(N-1) " dof2 = " (N*T-N*(K+1))
dof1 = 3 dof2 = 32

80 .
81 . local PVF2=Ftail(K*(N-1),(N*T-N*(K+1)),`F2')

82 .
83 .
84 .
85 . *Calcul de la statistique de Fisher F3
td variation finale EFFET FIXE Thursday November 17 11:42:47 2022 Page 6

86 .
87 . local F3=(`SCR1C'-`SCR1CP')*(N*(T-1)-K)/(`SCR1CP'*(N-1))

88 .
89 .
90 .
91 . *La P_value de F3

92 .
93 . di "dof1 = " (N-1) " dof2 = " (N*(T-1)-K)
dof1 = 3 dof2 = 35

94 .
95 . local PVF3=Ftail((N-1),(N*(T-1)-K),`F3')

96 .
97 .
98 .
99 . *Affichage des résultats

100 .
101 . di in y " SCR1 = " in gr `SCR1'
SCR1 = 481.18038

102 .
103 . di in y " SCR1C = " in gr `SCR1C'
SCR1C = 1838.9802

104 .
105 . di in y " SCR1CP = " in gr `SCR1CP'
SCR1CP = 491.47897

106 .
107 .
108 .
109 . di in y "F1 = " in gr `F1'
F1 = 15.049656

110 .
111 . di in y "F2 = " in gr `F2'
F2 = .22829612

112 .
113 . di in y "F3 = " in gr `F3'
F3 = 31.986817

114 .
115 .
116 .
117 . di in y "PvalF1 = " in gr `PVF1'
PvalF1 = 4.197e-08

118 .
119 . di in y "PvalF2 = " in gr `PVF2'
PvalF2 = .87600023

120 .
121 . di in y "PvalF3 = " in gr `PVF3'
PvalF3 = 3.900e-10
td variation finale EFFET FIXE Thursday November 17 11:42:47 2022 Page 7

122 . *Calcul de SCR1 non contraint:

123 .
124 . Estimationequation par equation
command Estimationequation is unrecognized
r(199);

125 .
126 . set more off

127 .
128 . local SCR1=0

129 .
130 . scalar N=4

131 .
132 . scalar T=10

133 .
134 . forvalues i=1/4 {
2.
135 . reg Y X if individus==`i'
3.
136 . local SCR1=`SCR1'+e(rss)
4.
137 . }

Source SS df MS Number of obs = 10


F(1, 8) = 102.29
Model 1686.77709 1 1686.77709 Prob > F = 0.0000
Residual 131.916155 8 16.4895193 R-squared = 0.9275
Adj R-squared = 0.9184
Total 1818.69324 9 202.077027 Root MSE = 4.0607

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

X 1.181347 .1168026 10.11 0.000 .9119993 1.450694


_cons .4077057 3.798497 0.11 0.917 -8.351644 9.167055

Source SS df MS Number of obs = 10


F(1, 8) = 43.75
Model 766.63144 1 766.63144 Prob > F = 0.0002
Residual 140.17161 8 17.5214512 R-squared = 0.8454
Adj R-squared = 0.8261
Total 906.80305 9 100.755894 Root MSE = 4.1859

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

X 1.034208 .1563507 6.61 0.000 .673663 1.394754


_cons 12.63109 4.832652 2.61 0.031 1.486975 23.77521

Source SS df MS Number of obs = 10


F(1, 8) = 128.26
Model 884.600955 1 884.600955 Prob > F = 0.0000
Residual 55.1740047 8 6.89675059 R-squared = 0.9413
Adj R-squared = 0.9340
Total 939.77496 9 104.41944 Root MSE = 2.6262

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

X 1.125312 .0993622 11.33 0.000 .8961819 1.354441


_cons 2.222415 2.7087 0.82 0.436 -4.023858 8.468688
td variation finale EFFET FIXE Thursday November 17 11:42:47 2022 Page 8

Source SS df MS Number of obs = 10


F(1, 8) = 53.20
Model 1023.56648 1 1023.56648 Prob > F = 0.0001
Residual 153.918609 8 19.2398261 R-squared = 0.8693
Adj R-squared = 0.8529
Total 1177.48509 9 130.831677 Root MSE = 4.3863

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

X 1.096799 .1503729 7.29 0.000 .7500383 1.443559


_cons 16.8034 4.493921 3.74 0.006 6.440396 27.1664

138 .
139 . display `SCR1'
481.18038

140 . Estimation equation par equation


command Estimation is unrecognized
r(199);

141 .

You might also like