0% found this document useful (0 votes)
6 views

Stata output Panel Hsiao 1986 Example

The document outlines a panel data analysis using Stata, focusing on a fixed-effects regression model with 225 observations across 9 groups. Key results include significant coefficients for variables x1 and x2, with an overall R-squared of 0.0039 and various calculated statistics including SCR and Fisher statistics. The document also provides detailed calculations for constrained and individual effects models, along with their respective p-values.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Stata output Panel Hsiao 1986 Example

The document outlines a panel data analysis using Stata, focusing on a fixed-effects regression model with 225 observations across 9 groups. Key results include significant coefficients for variables x1 and x2, with an overall R-squared of 0.0039 and various calculated statistics including SCR and Fisher statistics. The document also provides detailed calculations for constrained and individual effects models, along with their respective p-values.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Panel Hsiao 1986 Example Tuesday February 28 16:10:12 2023 Page 1

___ ____ ____ ____ ____(R)


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

1 . import excel "H:\hisao 1986 test Abdelkarim\application.xls", sheet("Feuil1") firstrow clear


(5 vars, 225 obs)

2 . *Declare data as panel data ############

3 .
4 .
5 .
6 . egen id = group(i)

7 .
8 . xtset id t , yearly

Panel variable: id (strongly balanced)


Time variable: t, 1950 to 1974
Delta: 1 year

9 .
10 .
11 .
12 . *Run Fixed effect regression ###########

13 .
14 .
15 .
16 . xtreg y x1 x2 ,fe

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


Group variable: id Number of groups = 9

R-squared: Obs per group:


Within = 0.0376 min = 25
Between = 0.3505 avg = 25.0
Overall = 0.0039 max = 25

F(2,214) = 4.18
corr(u_i, Xb) = -0.6099 Prob > F = 0.0166

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

x1 -49.50377 23.64297 -2.09 0.037 -96.10669 -2.900844


x2 22.17142 11.02105 2.01 0.046 .447697 43.89514
_cons 654.9109 181.7605 3.60 0.000 296.6407 1013.181

sigma_u 602.25463
sigma_e 955.82663
rho .28418579 (fraction of variance due to u_i)

F test that all u_i=0: F(8, 214) = 5.24 Prob > F = 0.0000

17 .
18 .
19 .
Panel Hsiao 1986 Example Tuesday February 28 16:10:13 2023 Page 2

20 . *Run this code to calculate SCR ##########

21 .
22 .
23 .
24 . set more off

25 .
26 . local SCR=0

27 .
28 . scalar N=9

29 .
30 . scalar T=25

31 .
32 . scalar K=2

33 .
34 . forvalues i=1/9 {
2.
35 . qui reg y x1 x2 if i==`i'
3.
36 . local SCR=`SCR'+e(rss)
4.
37 . }

38 .
39 . di `SCR'
1.836e+08

40 .
41 .
42 .
43 . *Run this code for calculation of constrained SCR1C: Estimation on the stacked model

44 .
45 . qui reg y x1 x2

46 .
47 .
48 .
49 . local SCR_C1=e(rss)

50 .
51 . di `SCR_C1'
2.338e+08

52 .
53 .
54 .
55 . *Fisher statistic calculation F1 N=8 T=11 K=7

56 .
Panel Hsiao 1986 Example Tuesday February 28 16:10:13 2023 Page 3

57 .
58 .
59 . local F1=((`SCR_C1'-`SCR')*(N*T-N*(K+1)))/(`SCR'*(N-1)*(K+1))

60 .
61 .
62 .
63 . *The P_value of F1

64 .
65 . di "dof1 = " (N-1)*(K+1) " dof2 = " (N*T-N*(K+1))
dof1 = 24 dof2 = 198

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

68 .
69 .
70 .
71 . * Calculation of SCR_C2: estimation of the individual effects model

72 .
73 .
74 .
75 . xtreg y x1 x2,fe

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


Group variable: id Number of groups = 9

R-squared: Obs per group:


Within = 0.0376 min = 25
Between = 0.3505 avg = 25.0
Overall = 0.0039 max = 25

F(2,214) = 4.18
corr(u_i, Xb) = -0.6099 Prob > F = 0.0166

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

x1 -49.50377 23.64297 -2.09 0.037 -96.10669 -2.900844


x2 22.17142 11.02105 2.01 0.046 .447697 43.89514
_cons 654.9109 181.7605 3.60 0.000 296.6407 1013.181

sigma_u 602.25463
sigma_e 955.82663
rho .28418579 (fraction of variance due to u_i)

F test that all u_i=0: F(8, 214) = 5.24 Prob > F = 0.0000

76 .
77 .
78 .
79 . local SCR_C2=e(rss)
Panel Hsiao 1986 Example Tuesday February 28 16:10:13 2023 Page 4

80 .
81 . di `SCR_C2'
1.955e+08

82 .
83 .
84 .
85 . *Fisher statistic calculation F2

86 .
87 .
88 .
89 . local F2=((`SCR_C2'-`SCR')*(N*T-N*(K+1)))/(`SCR'*(N-1)*K)

90 .
91 .
92 .
93 . *The P_value of F2

94 .
95 .
96 .
97 . di "dof1 = " K*(N-1) " dof2 = " (N*T-N*(K+1))
dof1 = 16 dof2 = 198

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

100 .
101 .
102 .
103 . *Fisher statistic calculation F3

104 .
105 . local F3=(`SCR_C1'-`SCR_C2')*(N*(T-1)-K)/(`SCR_C2'*(N-1))

106 .
107 .
108 .
109 . *The P_value of F3

110 .
111 . di "dof1 = " (N-1) " dof2 = " (N*(T-1)-K)
dof1 = 8 dof2 = 214

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

114 .
115 .
116 .
117 . *Display of results

118 .
119 . di in y " SCR = " in gr `SCR'
SCR = 1.836e+08
Panel Hsiao 1986 Example Tuesday February 28 16:10:13 2023 Page 5

120 .
121 . di in y " SCR_C1 = " in gr `SCR_C1'
SCR_C1 = 2.338e+08

122 .
123 . di in y " SCR_C2 = " in gr `SCR_C2'
SCR_C2 = 1.955e+08

124 .
125 . di in y "F1 = " in gr `F1'
F1 = 2.2558862

126 .
127 . di in y "F2 = " in gr `F2'
F2 = .80404312

128 .
129 . di in y "F3 = " in gr `F3'
F3 = 5.2362891

130 .
131 . di in y "PvalF1 = " in gr `PVF1'
PvalF1 = .00124471

132 .
133 . di in y "PvalF2 = " in gr `PVF2'
PvalF2 = .68011794

134 .
135 . di in y "PvalF3 = " in gr `PVF3'
PvalF3 = 5.391e-06

136 .

You might also like