Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Compare coefficients across groups in panel data
From
Simon Pickert <[email protected]>
To
[email protected]
Subject
st: Compare coefficients across groups in panel data
Date
Tue, 17 Dec 2013 13:14:21 +0100
Dear Statlisters,
[This is not a speficic Stata question, but rather a statistics question, for which I’d appreciate your help very much!]
I want to compare regression coefficients across two groups. I have a panel data set and I use a fixed-effects regression, so things are a little bit more tricky than with a standard regression in which I could easily use interaction terms to test across for differences in coefficients across groups. In the final (panel) data set, I can’t identify my groups anymore, because I’m aggregating over them (in order to end up at a daily level).
Please, have a look at this example:
Research question: Is the relation between cost of ice-cream and ice-cream rating stronger for adults than for children?
Imagine 2 groups of people: Adults and children. Over 1 month, you record how much every person spend on ice-cream (4 sorts), how they rated the ice-cream and what size of ice-cream they got. Your dependent variable is rating, your independent variables are cost and size.
+—————————————————————+
| day | ice-cream | rating | cost | size | group |
+—————————————————————+
1. | 1 | vanilla | 2 | 3 | 4 | 1 |
2. | 1 | choco | 1 | 4 | 3 | 0 |
3. | 1 | vanilla | 2 | 2 | 1 | 1 |
4. | 1 | hazelnut | 9 | 2 | 1 | 0 |
5. | 2 | hazelnut | 2 | 1 | 1 | 0 |
6. | 2 | hazelnut | 5 | 1 | 1 | 0 |
7. | 2 | vanilla | 6 | 5 | 2 | 1 |
8. | 3 | berry | 1 | 6 | 3 | 0 |
9. | 3 | berry | 6 | 4 | 2 | 0 |
10. | 3 | berry | 7 | 3 | 4 | 1 |
11. | 3 | berry | 5 | 2 | 1 | 1 |
12. | 3 | vanilla | 4 | 1 | 2 | 0 |
13. | 3 | vanilla | 4 | 5 | 2 | 0 |
etc | . | ...... | . | . | … | . |
+—————————————————————+
Not caring about groups at all, I could just aggregate the data to a day-icecream level (because I want to consider fixed effects at the ice-cream level!). My panel dataset would look like this:
+—————————————————+
| day | ice-cream | rating | cost | size |
+—————————————————+
1. | 1 | vanilla | 2 | 2.5 | 2.5 |
2. | 1 | choco | 1 | 4 | 3 |
3. | 1 | hazelnut | 9 | 2 | 1 |
4. | 2 | hazelnut | 3.5 | 1 | 1 |
5. | 2 | vanilla | 6 | 5 | 2 |
6. | 3 | berry | 4.75 | 3.7 | 2.5 |
7. | 3 | vanilla | 4 | 3 | 2 |
etc | . | ...... | . | . | ... |
+—————————————————+
However, this doesn’t allow me to calculate a regression model for each group.
So, I followed a different path: I split the raw data set according to groups (one set for each group) and aggregated to the daily level afterwards. The two panel datasets looks like this:
Group 1 (Adults)
+———————————-————————+
| day | ice-cream | rating | cost | size | group |
+———————————-————————+
1. | 1 | vanilla | 1.5 | 2.5 | 2.5 | 1 |
2. | 2 | vanilla | 6 | 5 | 2 | 1 |
3. | 3 | berry | 7 | 3 | 4 | 1 |
4. | 3 | vanilla | 6 | 2.5 | 2.5 | 1 |
etc | . | ...... | . | . | … | . |
+———————————————————+
Group 2 (Children)
+———————————-————————+
| day | ice-cream | rating | cost | size | group|
+———————————-————————+
1. | 1 | choco | 1 | 4 | 3 | 0 |
2. | 1 | hazelnut | 9 | 2 | 1 | 0 |
3. | 2 | hazelnut | 3.5 | 1 | 1 | 0 |
4. | 3 | berry | 3.5 | 5 | 2.5 | 0 |
5. | 3 | vanilla | 4 | 3 | 2 | 0 |
etc | . | ...... | . | . | … | . |
+———————————-————————+
For each dataset, I run a fixed-effects regression. This leaves me with two model outputs which I want to compare and see whether the coefficients are different.
Any ideas how to test coefficients across models in this case?
Thank you
Simon
P.S. I asked this question at cross-validated as well, in case the tables above are difficult to read: http://stats.stackexchange.com/questions/78431/compare-coefficients-across-groups-in-panel-data-set
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/