I have monthly grain prices of a county in ancient China. However, the archive does not include price very completely. The dataset is shown below. I used
xtset YEAR MONTH
tsfill,full
to expand the time.
I want to use fixed effect of year and month to fill the blanks. The idea is
xi: reg PRICE i.YEAR i.MONTH, fillin
But Stata says "fillin option not allowed"
I want to know how I can fill in the blanks based on time fixed effect. Thank you very much for your advice!
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int YEAR byte MONTH double PRICE_IN_SILVER 1866 1 .4000000059605 1866 2 . 1866 3 . 1866 4 .4000000059605 1866 5 . 1866 6 .4000000059605 1866 7 . 1866 8 .3000000119209 1866 9 .3199999928474 1866 10 . 1866 11 .3000000119209 1866 12 .3000000119209 1867 1 .3000000119209 1867 2 .3000000119209 1867 3 . 1867 4 . 1867 5 .3000000119209 1867 6 . 1867 7 .3000000119209 1867 8 . 1867 9 . 1867 10 . 1867 11 . 1867 12 . 1868 1 . 1868 2 . 1868 3 . 1868 4 .3600000143051 1868 5 . 1868 6 .3600000143051 1868 7 . 1868 8 .4000000059605 1868 9 . 1868 10 .5 1868 11 . 1868 12 .3600000143051 1869 1 . 1869 2 . 1869 3 . 1869 4 .3600000143051 1869 5 .3600000143051 1869 6 .3600000143051 1869 7 .4799999892712 1869 8 . 1869 9 .7799999713898 1869 10 .9200000166893 1869 11 . 1869 12 .9800000190735 1870 1 . 1870 2 .9800000190735 1870 3 . 1870 4 1.1299999952316 1870 5 . 1870 6 1.1299999952316 1870 7 . 1870 8 1.1299999952316 1870 9 . 1870 10 1.1799999475479 1870 11 1.1299999952316 1870 12 . 1871 1 . 1871 2 . 1871 3 . 1871 4 1.2300000190735 1871 5 . 1871 6 . 1871 7 1.1200000047684 1871 8 . 1871 9 . 1871 10 1.3500000238419 1871 11 . 1871 12 . 1872 1 . 1872 2 . 1872 3 1.25 1872 4 . 1872 5 . 1872 6 . 1872 7 . 1872 8 . 1872 9 . 1872 10 . 1872 11 . 1872 12 . 1873 1 . 1873 2 . 1873 3 .5 1873 4 .5 1873 5 . 1873 6 .4099999964237 1873 7 . 1873 8 .589999973774 1873 9 .5400000214577 1873 10 .5600000023842 1873 11 . 1873 12 .5799999833107 1874 1 . 1874 2 .6200000047684 1874 3 .6800000071526 1874 4 .6800000071526 end
0 Response to How to fill in created blank based on predicted value generated from time fixed effect?
Post a Comment