1
$\begingroup$

i am quite confused about creating a fixed effects model. How exactly does the Fixed effects model differ from the basic model with fixed countrys, because up until now i thought that this model would be my Fixed effects model. So my plan is to run three models:

  1. Basic model with fixed countrys
  2. Random effects with country intercept
  3. Fixed effects model without countrys (here i have no idea, on how to create this model anymore)

This is my code:

##country-level fixed effects
model_fes <- as.formula("comp ~  factor(country) + h + c + wd + ra + ac + ov")
clog_fes = glm(model_fes,data=df,family = binomial(link = cloglog))
summary(clog_fes)
summ(clog_fes)

random intercept with country-level effects

library(lme4)
model_res<- as.formula("comp ~  (1|country) + h + c + wd + ra + ac + ov")
clog_res = glmer(model_re1,data=df,family = binomial(link = cloglog))
summary(clog_res)
summ(clog_res)

fixed effects model

??

$\endgroup$
3
  • $\begingroup$ "Without countries", sounds like just not including the countries, isn't it? $\endgroup$
    – Tim
    Commented Jun 10, 2020 at 11:32
  • $\begingroup$ would that then mean that i put the people where i have the country-fixed effects now, i.e. factor (people)? $\endgroup$
    – lisamue
    Commented Jun 10, 2020 at 11:34
  • $\begingroup$ I thought there might be a difference in fixed effects model and just fixed effects if that makes sense $\endgroup$
    – lisamue
    Commented Jun 10, 2020 at 11:35

2 Answers 2

1
$\begingroup$

It seems to me that the three models are actually three different things. It is normal that there is some confusion about the terms "fixed" and "random" effects, because different applied fields use them differently, see for example here: https://statmodeling.stat.columbia.edu/2005/01/25/why_i_dont_use/

Within a more econometric reading of your question, model 3 would refer to a model where values all variables are de-meaned for country (i.e., you subtract the country-level mean from each observation, across all variables). In this case you will not need to include country explicitly as a predictor variable, so the model would indeed be "without countries", as in your description. This is typically called the fixed effects estimator in econometrics, or the within estimator (because you reduce your data to variation within countries only). You can do this in R for example by using plm::plm() with model = "within". The plm package, which can do all three model types you mentioned, is described in detail here: https://cran.r-project.org/web/packages/plm/vignettes/plmPackage.html

Note that the estimates and standard errors should be exactly identical to the case where you simply add dummies for country to your model matrix via factor(country) (model 1).

Model 1 is actually known as the LSDV (Least Square Dummy Variable) approach in econometrics. Equivalence between fixed effects and LSDV estimator is further shown and discussed in chapter 10.2 of

  • Verbeek, M. (2008). A guide to modern econometrics. John Wiley & Sons.

A note of cuation: De-meaning by hand and then running a simple lm() on the de-meaned data will lead to a fixed effects model with biased standard errors, because lm() will calculate with too many degrees of freedom, as if there were no country variables used at all. So better simply use plm(), which corrects for this.

$\endgroup$
3
  • $\begingroup$ Thank you for your in-depth answer, very helpful. Do you by chance know if the plm package can run a cloglog regression? I did not find any evidence $\endgroup$
    – lisamue
    Commented Jun 10, 2020 at 20:11
  • $\begingroup$ also sadly the plm package is not able to run cloglog analysis, i am looking for a package that can run the within analysis and cloglog $\endgroup$
    – lisamue
    Commented Jun 10, 2020 at 20:21
  • $\begingroup$ You can use any package and function you like if you go for de-meaning by hand before rubning the analysis. Just correct the degrees of freedom in your calculation of the coefficients' variance $\endgroup$
    – stefgehrig
    Commented Jun 10, 2020 at 20:27
1
$\begingroup$

I think their is a problem with the terms. A (classical) model, whithout introducing a random effect, is what you seem to call a fixed effect model. All the effects are fixed, their are not a random sample of a larger population.

For your models, before trying to fit everything, you should determine what you want.

  • Do you have a fixed (small) number of different countries? It means, if new samples are to be gathered, they would come from the same countries? And are you really interrested by the specific impact of, say, UK, on your comp variable? In this case, you put country as a fixed effect and go for your first model.

  • Or do you have a high number of different countries, and want to draw conclusions for data coming from maybe new countries? In this case, you need to take into account for the country effect, because it creates correlations between residuals, and thus you go for the mixed models, your second model.

But to my knowledge, their is no differences between your first model and what could be a fixed effects model !

Hope it helps...

$\endgroup$
1
  • $\begingroup$ thank you, this helped me a lot and clarified stuff. So when i want to run the fixed effects model, i just can take the code from the first model. $\endgroup$
    – lisamue
    Commented Jun 10, 2020 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.