2
$\begingroup$

Let's say I have data on firms (nested within countries). Some firms are multinational, others only have a single instance. The dependent variable is revenue. What is the appropriate way to account for the clustering structure of this relationship?

If using a mixed effects approach, my intuition is to treat country-firmID as a nested random effect like so (1| country/FirmID)

lmer(log_revenue ~ scale(country_gdp) + scale(country_population) + scale(employee_count) + I(scale(employee_count)^2) + (1|country/firmID), data = df)

However, in some versions of this specification I get Error: number of levels of each grouping factor must be < number of observations, but I'm not sure how the total number of levels of a grouping factor are being calculated. Some FirmIDs are in more than one country, and some are in the same country more than once.

In other versions of the specification I get the error: convergence code 3 from bobyqa: bobyqa -- a trust region step failed to reduce qunable to evaluate scaled gradient Hessian is numerically singular: parameters are not uniquely determinedModel may not have converged with 1 eigenvalue close to zero: 0.0e+00

Re-running the code by assuming country and firm random effects runs without convergence issues, but I don't think it's appropriate to not account for the nested nature of firms and countries:

lmer(log_revenue ~ scale(country_gdp) + scale(country_population) + scale(employee_count) + I(scale(employee_count)^2) + (1|firmID) +(1|country), data = df)

More generally, is this the right way to model the relationship -- or, is it more appropriate to do something like this -

felm(log_revenue ~ scale(country_gdp) + scale(country_population) + scale(employee_count) + I(scale(employee_count)^2) | firmID |  0 | country,  data = df)

Where I add fixed effects for firm, and cluster by country. Conceptually, what is the difference between these two approaches, as they tend to yield similar results?

As mentioned in the comment below, I'm particularly interested in understanding the intuition behind the difference between the following: (1|firmID) +(1|country), (1|country\firmID) adding fixed effects at both the country and firmID level, and adding fixed effects for firmID and clustering standard errors at the country level.

$\endgroup$
3
  • $\begingroup$ Do you have more than one observation per firm?? $\endgroup$
    – Ben Bolker
    Commented Nov 15, 2018 at 23:59
  • $\begingroup$ A "row" in the dataframe is aggregated at the firm-country level. But, for a given firmID (e.g. Apple) that firm will exist in multiple countries and therefore have multiple rows attached to that firmID. Some firmIDs are therefore associated with multiple countries (if it's a multinational company), other firmIDs just have one country (if it's a start-up, for example) $\endgroup$ Commented Nov 16, 2018 at 0:02
  • $\begingroup$ @BenBolker, thoughts? $\endgroup$ Commented Nov 16, 2018 at 15:00

1 Answer 1

1
$\begingroup$

You are trying to fit a hierarchical model to data that are not hierarchical (firms belong to any number of countries, so are not nested in the sense we use the term in multilevel modeling). I would look into cross-classified models.

$\endgroup$
4
  • $\begingroup$ Is there another term for "cross-classified" models? That term yields some sparse results, and no R tutorials $\endgroup$ Commented Nov 15, 2018 at 20:59
  • $\begingroup$ Check this out: lme4.r-forge.r-project.org/book/Ch2.pdf But essentially it's just: (1| country) + (1|FirmID) $\endgroup$
    – Justin
    Commented Nov 15, 2018 at 22:15
  • $\begingroup$ Thanks so much! Do you know how this is substantively different from just adding fixed effects for country and firm ID? Or how that is different from adding fixed effects for firm and clustering standard errors at the country level? $\endgroup$ Commented Nov 15, 2018 at 22:19
  • 1
    $\begingroup$ Adding fixed effects for both levels will likely lead to collinearity. If you're only concerned about clustering, I'd go with fixed effects for firms and clustered SEs for countries. Multilevel models are very flexible and allow you to do things like estimate the degree to which mean revenue within a particular firm deviates from the overall mean, conditional on the mean revenue in that country. They also yield more valid SEs when you have a higher-level predictor (e.g. country GDP) compared to clustered SEs. $\endgroup$
    – Justin
    Commented Nov 16, 2018 at 16:34

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.