Dear all,
I am now using worldbank data to see how GDP per capita affects infant motality from 1990-2015, and I want to take total population of each country as fweight when performing panel data analysis. But stata does not allow me to use time-variant weights in xtreg, what should I do in order to consider the populaiton size of different countries.
Below is my stata code
then I get the result shown below, it seems I should take population fixed across years. what should I to do next?
. xtreg infantmortality gdppc [fweight=poptotl], fe
weight must be constant within country
r(199);
All the best,
Zhicheng
I am now using worldbank data to see how GDP per capita affects infant motality from 1990-2015, and I want to take total population of each country as fweight when performing panel data analysis. But stata does not allow me to use time-variant weights in xtreg, what should I do in order to consider the populaiton size of different countries.
Below is my stata code
wbopendata, indicator(SP.DYN.IMRT.IN ; NY.GDP.PCAP.PP.KD ; SP.POP.TOTL) long clear
rename sp_dyn_imrt_in infantmortality
rename ny_gdp_pcap_pp_kd gdppc
rename sp_pop_totl poptotl
encode countrycode, gen(country)
xtset country year
xtdes
xtreg infantmortality gdppc [fweight=poptotl], fe
rename sp_dyn_imrt_in infantmortality
rename ny_gdp_pcap_pp_kd gdppc
rename sp_pop_totl poptotl
encode countrycode, gen(country)
xtset country year
xtdes
xtreg infantmortality gdppc [fweight=poptotl], fe
. xtreg infantmortality gdppc [fweight=poptotl], fe
weight must be constant within country
r(199);
All the best,
Zhicheng
Comment