Hi all,
I have three countries and each of them was surveyed two times at least (country C) and three times at most (countries A and B). I pool the data together and then examine the determinant of y. In the data, observations are uniquely identified by three variables: id, round, and country.
First, I create a paneled variable and tell Stata that I will use panel regressions as follows:
Second, I use xtpoisson command since my dedepent variable is a count
Since I do not have much experience with panel data analysis, I am not sure if my code above is correct. I would appreciate if anyone can take a look at my code and give advice if any. Thanks!
Data example
I have three countries and each of them was surveyed two times at least (country C) and three times at most (countries A and B). I pool the data together and then examine the determinant of y. In the data, observations are uniquely identified by three variables: id, round, and country.
First, I create a paneled variable and tell Stata that I will use panel regressions as follows:
Code:
egen panelid = group(id country)
xtset panelid round
Code:
qui xtpoisson y x1 x2 x3, re vce(cluster panelid)
margins, dydx(*)
Data example
Code:
clear input float(id round country y x1 x2 x3) 1 1 1 15 1 1 1 1 2 1 15 1 0 1 1 3 1 15 1 0 1 1 1 2 1 0 1 1 1 2 2 1 0 0 1 1 3 2 1 0 1 1 1 1 3 2 0 0 0 1 2 3 2 0 0 0 2 1 1 10 1 1 1 2 2 1 10 1 0 1 2 3 1 10 1 0 1 2 1 2 1 0 1 1 2 2 2 1 0 0 1 2 3 2 1 0 1 1 2 1 3 5 0 0 1 2 2 3 5 0 0 1 3 1 1 10 0 1 1 3 2 1 10 0 0 1 3 1 2 8 0 1 1 3 2 2 8 0 0 1 3 3 2 8 0 1 1 3 1 3 1 0 0 0 4 1 1 2 1 0 1 4 2 1 3 1 1 1 4 1 2 2 0 0 1 4 2 2 2 0 0 1 4 1 3 5 0 1 0 4 2 3 5 0 0 0 5 3 1 3 1 1 1 5 1 2 1 0 0 1 5 2 2 1 0 1 1 5 3 2 1 0 0 1 5 1 3 7 1 0 1 6 1 1 7 0 1 0 6 2 1 7 0 0 0 6 3 1 7 0 0 0 6 1 2 100 0 1 1 6 2 2 100 0 0 1 6 3 2 100 0 0 1 6 1 3 10 0 1 1 6 2 3 10 0 0 1 7 1 1 15 1 0 1 7 2 1 8 1 1 1 7 1 2 2 0 0 1 7 2 2 2 0 1 1 7 3 2 2 0 0 1 7 1 3 5 0 0 1 7 2 3 5 0 1 1 8 1 1 4 1 0 1 8 2 1 10 1 0 1 8 1 2 10 0 1 1 8 2 2 10 0 0 1 8 3 2 10 0 0 1 8 1 3 3 0 1 1 8 2 3 3 0 0 1 9 1 1 1 1 0 0 9 2 1 1 1 1 0 9 3 1 1 1 0 0 9 1 2 4 0 1 1 9 2 2 4 0 1 1 9 3 2 4 0 0 1 9 1 3 1 0 1 1 9 2 3 1 0 0 1 10 1 1 30 1 1 1 10 2 1 5 1 0 1 10 1 2 0 0 0 1 10 2 2 0 0 1 1 10 2 3 5 0 0 1 11 1 1 40 1 1 1 11 2 1 40 1 0 1 11 3 1 40 1 0 1 11 1 2 20 0 1 1 11 2 2 20 0 0 1 11 3 2 20 0 0 1 11 1 3 12 0 1 1 11 2 3 12 0 0 1 12 1 1 8 1 0 0 12 2 1 8 1 1 0 12 3 1 8 1 0 0 12 1 2 1 0 1 1 12 2 2 1 0 0 1 12 3 2 1 0 1 1 12 1 3 3 0 0 1 12 2 3 3 0 0 1 13 1 1 100 0 1 1 13 2 1 100 0 0 1 13 3 1 100 0 0 1 13 1 2 7 0 1 1 13 2 2 7 0 0 1 13 3 2 7 0 0 1 13 1 3 7 0 1 1 13 2 3 7 0 0 1 14 1 1 10 1 0 1 14 2 1 10 1 1 1 14 3 1 10 1 0 1 14 1 3 10 0 0 1 14 2 3 10 0 0 1 15 1 1 0 0 1 0 15 2 1 0 0 0 0 15 3 1 0 0 0 0 15 1 2 20 0 1 1 15 2 2 20 0 0 1 15 3 2 20 0 0 1 15 1 3 4 1 0 1 end label values country country label def country 1 "A", modify label def country 2 "B", modify label def country 3 "C", modify

.
Comment