Dear all,
I am working on the following data
A short explanation:
It it paneldata: gvkey is a company identifier and FYQ is the time identifier like 2009q1, so it is quarterly data. i have used
to declare my data as paneldata.
niq is the net income in FYQ while fniq is the net income 4 quarters ahead, so the same quarter in the next fiscal year.
now, i want to estimate a regression of fniq on niq, so the dependent variable is fniq and the independent variable is niq. So far, so easy. My problem: I want to run the regression for each firm (each gvkey) and create a new variable that is the coefficient of niq from the regression. Do you have any idea how to deal with this? Thanks!
I am working on the following data
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str6 gvkey float FYQ double niq float fniq "001004" 118 6.109 3.977 "001004" 119 6.224 4.001 "001004" 120 6.697 3.444 "001004" 121 .126 2.686 "001004" 122 3.977 2.88 "001004" 123 4.001 1.01 "001004" 124 3.444 3.103 "001004" 125 2.686 1.575 "001004" 126 2.88 -5.705 "001004" 127 1.01 1.31 "001004" 128 3.103 2.492 "001004" 129 1.575 2.378 "001004" 130 -5.705 2.212 "001004" 131 1.31 2.412 "001004" 132 2.492 2.005 "001004" 133 2.378 2.067 "001004" 134 2.212 2.876 "001004" 135 2.412 3.515 "001004" 136 2.005 3.226 "001004" 137 2.067 3.691 "001004" 138 2.876 4.089 "001004" 139 3.515 5.006 "001004" 140 3.226 4.848 "001004" 141 3.691 5.144 "001004" 142 4.089 5.94 "001004" 143 5.006 7.093 "001004" 144 4.848 7.31 "001004" 145 5.144 8.411 "001004" 146 5.94 9.314 "001004" 147 7.093 10.622 "001004" 148 7.31 9.623 "001004" 149 8.411 10.035 "001004" 150 9.314 10.278 "001004" 151 10.622 11.735 "001004" 152 9.623 10.831 "001004" 153 10.035 10.906 "001004" 154 10.278 10.955 "001004" 155 11.735 2.471 "001004" 156 10.831 3.159 "001004" 157 10.906 4.278 "001004" 158 10.955 5.388 "001004" 159 2.471 5.706 "001004" 160 3.159 .486 "001004" 161 4.278 -54.484 "001004" 162 5.388 -2.29 "001004" 163 5.706 -2.651 "001004" 164 .486 -4.879 "001004" 165 -54.484 -.663 "001004" 166 -2.29 .651 "001004" 167 -2.651 -7.519 "001004" 168 -4.879 -1.996 "001004" 169 -.663 .916 "001004" 170 .651 2.012 "001004" 171 -7.519 2.572 "001004" 172 -1.996 2.286 "001004" 173 .916 4.839 "001004" 174 2.012 2.595 "001004" 175 2.572 5.733 "001004" 176 2.286 5.258 "001004" 177 4.839 7.876 "001004" 178 2.595 9.13 "001004" 179 5.733 12.899 "001004" 180 5.258 11.784 "001004" 181 7.876 13.768 "001004" 182 9.13 15.261 "001004" 183 12.899 17.847 "001004" 184 11.784 15.153 "001004" 185 13.768 17.855 "001004" 186 15.261 20.095 "001004" 187 17.847 22.041 "001004" 188 15.153 14.975 "001004" 189 17.855 10.407 "001004" 190 20.095 17.214 "001004" 191 22.041 14.176 "001004" 192 14.975 10.204 "001004" 193 10.407 13.312 "001004" 194 17.214 9.912 "001004" 195 14.176 11.2 "001004" 196 10.204 13.674 "001004" 197 13.312 16.814 "001004" 198 9.912 17.918 "001004" 199 11.2 21.42 "001004" 200 13.674 16.6 "001004" 201 16.814 17.581 "001004" 202 17.918 20.663 "001004" 203 21.42 12.879 "001004" 204 16.6 18.2 "001004" 205 17.581 17.8 "001004" 206 20.663 18.4 "001004" 207 12.879 .6 "001004" 208 18.2 17.9 "001004" 209 17.8 20 "001004" 210 18.4 17.9 "001004" 211 .6 17.1 "001004" 212 17.9 14.4 "001004" 213 20 15.2 "001004" 214 17.9 -34.5 "001004" 215 17.1 15.1 "001004" 216 14.4 22.9 "001004" 217 15.2 8 end format %tq FYQ
It it paneldata: gvkey is a company identifier and FYQ is the time identifier like 2009q1, so it is quarterly data. i have used
Code:
xtset gvkey FYQ
niq is the net income in FYQ while fniq is the net income 4 quarters ahead, so the same quarter in the next fiscal year.
now, i want to estimate a regression of fniq on niq, so the dependent variable is fniq and the independent variable is niq. So far, so easy. My problem: I want to run the regression for each firm (each gvkey) and create a new variable that is the coefficient of niq from the regression. Do you have any idea how to deal with this? Thanks!

Comment