1

I have 2 random effects models which differs from each other based on one variable.

M1= plm(formula = Productiviteit ~ Kapitaalintensiteit + Bedrijfsgrootte + 
    Percentage_Hoogopgeleid + Gem_leeftijd_TMT + Aantal_leden_TMT + 
    J_2012 + J_2013 + J_2014 + J_2015 + J_2016 + J_2017 + J_2018 + 
    A + B + C + D + E + F + G + H + I + J + K + L + N + O + P + 
    Q + R + S, data = df, model = "random", index = c("Naam", 
    "Index_jaar"))

M2= plm(formula = Productiviteit ~ Kapitaalintensiteit + Bedrijfsgrootte + 
    Percentage_Hoogopgeleid + Std_leeftijd_TMT + Gem_leeftijd_TMT + 
    Aantal_leden_TMT + J_2012 + J_2013 + J_2014 + J_2015 + J_2016 + 
    J_2017 + J_2018 + A + B + C + D + E + F + G + H + I + J + 
    K + L + N + O + P + Q + R + S, data = df, model = "random", 
    index = c("Naam", "Index_jaar"))

in Model 2 I only added Std_leeftijd_TMT.

Now I want to compare these 2 models and see if model 2 has a significant better fit. I want to test this with lrtest(test1,test2), but i get following error: Error in UseMethod("logLik") : no applicable method for 'logLik' applied to an object of class "c('plm', 'panelmodel')"

Are there any other possibilities for comparing two random effects models?

  • You could use AIC eg `AIC(M1, M2)` https://stats.stackexchange.com/questions/16013/allowed-comparisons-of-mixed-effects-models-random-effects-primarily – Skaqqs Apr 28 '22 at 16:11
  • I doubt that will work @Skaqqs, since `AIC` (at least `AIC.default`) will also call `logLik` internally, which appears to be undefined for `plm` models. I don't know anything about what this `plm` model does, but if you can express it using a different package like `nlme` or `lme4`, there will be more options available. But it seems you can also write your own `logLik` for `plm` as shown here: https://stackoverflow.com/questions/64186453/r-extract-log-likelihood-from-a-plm-object – Axeman Apr 28 '22 at 16:18
  • 1
    You're right @Axeman. Another of example of calculating AIC/logLik manually: https://stackoverflow.com/questions/46186527/how-to-calculate-bic-and-aic-for-a-gmm-model-in-r-using-plm – Skaqqs Apr 28 '22 at 16:22

0 Answers0