0
Follow
2
View

Given the TFP of each prefecture-level city in each year, how to calculate the national TFP of each year

chen19860602 注册会员
2023-01-25 12:09

Happy New Year, please accept:
You can use the STATA "xtset" command to spread out the length of the data, and then use the "xtsum" command to calculate the average. The specific steps are as follows:

1. Use the "xtset year city" command to set the data in long format, where year is the time variable and city is the prefecture-level city variable.
2. Run the "xtsum TFP" command to obtain the average value of TFP each year. 3. Use the "xtreg TFP year, fe" command to carry out fixed effect regression and get the TFP

of each year in the whole country.

Example:
Suppose that your data is stored in the variable "TFP", the time variable is "year", and the city variable is "city". You can follow these steps:

1. First, use the "xtset year city" command to set the data in a long format. This automatically creates some new variables, such as "panel variable: year(strongly balanced)" and "group variable: city(strongly balanced)".
2. Next, use the "xtsum TFP" command to find the average value of TFP for each prefecture-level city each year. This results in a new table containing information such as the average of TFPS for each year, the number of samples, and so on.
3. Then, perform fixed effect regression using the "xtreg TFP year, fe" command. So you can get the national TFP for each year.

About the Author

Question Info

Publish Time
2023-01-25 12:09
Update Time
2023-01-25 12:09