# Regression for individuals grouped using fixed effect

I have some questions about how to define my regression.

So, I want to use fixed effect model in order to estimate the effect of trade openness on gini coefficient. I include 58 countries including developed and developing countries.

$$Y_{it} = Z_i + B_{it} Trade + U_{it}$$

However, I'm still confused whether to set the "i" as "country" or the category whether its "developed or developing" because I want to see the results for both developed and developing countries. If I set the "i" as the "country", does it mean that I have 58 intercepts in total?

(I'm using R by the way) Thanks a lot guys.

• Do you have multiple years of data for each country, or only one? – Peter Flom Apr 22 at 11:20
• Yes, I have multiple years,from 1980 - 2017 – zahrina adani Apr 22 at 11:43

Per your comment, you have multiple years for each country. You need to account for that. One way is with a multilevel model. Two such that might be good for you are a random intercept model and a random slopes and intercepts model.

These can be modeled as

$$y = X\beta + Z\gamma + \epsilon$$

where y is a $$nx1$$ vector of the dependent variable, X is an $$nxp$$ matrix of independent variables, $$\beta$$ and $$\gamma$$ are parameters to be estimated ($$beta$$ is for "fixed" effects and $$\gamma$$ for "random" effects) and $$\epsilon$$ is error.

You will need more than one independent variable - one for "trade" and one for "type of country". However, I would caution against categorizing countries into "developing" and "developed". It would be better to use some continuous measure of how developed a country is. Categorizing continuous IVs is a bad idea. In his book Regression Modeling Strategies Frank Harrell gives a list of reasons and concludes with "nothing could be more disastrous" (it's an excellent book). I recently wrote an article demonstrating, graphically, what happens when we categorize continuous variables.

There are at least two R packages for this sort of model: LME4 and NLME.

However, I'm still confused whether to set the "i" as "country" or the category whether its "developed or developing" because I want to see the results for both developed and developing countries.

Either model could be valid. If you think all developed and undeveloped countries should have the same base rate of inequality other than what is explained by your observable controls, you could use developed vs undeveloped. But I would probably go with country fixed effects because there are likely to be important unobservable country-specific features and with so many observations for each country you shouldn't have trouble estimating them well.

If I set the "i" as the "country", does it mean that I have 58 intercepts in total?

It means you have 57 intercepts total. If you had 58 you would run into the "dummy variable trap."