# Whether to use a hierarchical linear model

I've been reading through Gelmans book: Data Analysis Using Regression and Multilevel/Hierarchical Models trying to learn more about how to implement hierarchal models. I have a dataset that I think is appropriate for this type of modeling however I want to get some other opinions. Basically the data I have is structured like this:

BRAND       YEAR         Y           X1          X2         X3
company_1   2012    0.638042396 0.226787359 0.192104136 0.929220784
company_2   2012    0.983422117 0.308550049 0.527779594 0.106629747
company_n   2012    0.209276388 0.700314863 0.741787081 0.491451885
company_1   2013    0.833955686 0.735844101 0.518474158 0.117670754
company_2   2013    0.480778935 0.290739025 0.156177295 0.212643611
company_n   2013    0.69922326  0.188574282 0.448743735 0.609844836
company_1   2014    0.942147995 0.176500074 0.820207708 0.388313924
company_2   2014    0.503095705 0.987218933 0.834039587 0.42661805
company_n   2014    0.46569344  0.310693712 0.852694246 0.17574502


where I have about 15 different companies for each year. My thought was to have a model like this:

lmer(Y ~  X1 + X2 + X3 + (1 | BRAND) , h.data)


where I have a varying intercept for each company. So my question here is whether or not it makes sense to use a hierarchal model and if my data fits the archetype of hierarchal data? Also should I be including YEAR into the model somehow?

While I agree that multi-level modeling is an option for data with this structure, it's not the only option, especially given the lone time series dimension. Typically, the nestings within a heterarchical model are by category, e.g., students within classes or teachers, classes within schools, and so on, not ordinal dimensions like time.

Gelman and Hill's book is great, I agree. Perhaps even better is Singer and Willet's book Applied Longitudinal Data Analysis which, to one poster's point, goes into much greater depth than G&H on some topics, e.g., growth models, issues related to constructing an interpretable intercept, curvilinearity and survival analysis but S&W lack a Bayesian focus.

If you had an additional factor called "industry", then I would lean more strongly towards a heterarchical model. Given that you don't (i.e., you haven't posited "industry" as a factor. Do these companies belong to a single industry? How about by 6 or 8 digit SIC or NAIC codes?), another consideration would be pooled time series or event history analysis as it's called in sociology. Here, the advantages are that the models can be estimated in OLS, a more tractable functional form than multi-level models and that the industrial, organizational and economic literature has a long-standing history of published papers in this domain, beginning at least with F.M. Scherer but continuing up to the near-present with books like Wooldridge's Econometric Analysis of Cross Section and Panel Data.

My personal favorite in the field of PTS is Lee Cooper's ebook, Market Share Analysis, available on his UCLA website. Ignore the "share" part and even the "marketing" part. It's simply a great introduction to this class of models and it's quite accessible without sacrificing scientific rigor (he's an emeritus professor of mktg science). Not to mention that he develops different and carefully specified functional forms in terms of the data structure, elasticities, cross-elasticities and very practical advice on how to build these into your model. Depending on what your X factors are, this could be quite useful information.

• Great I will check out these resources. All the companies are from the same industry. Since that is the case you recommend a non-multilevel approach? – moku Jun 11 '15 at 17:42
• Yup. As noted, heterarchies are typically defined by categorical nestings, not time. – Mike Hunter Jun 11 '15 at 17:44
• Right. YEAR was a point of confusion for me I wasn't sure how to incorporate it into a multilevel model. Y = awareness(as a %) and my X variable are spend in various advertising channels (digital, tv, radio, print). Is there a specific package in R that accomplishes what Cooper talks about or are his suggestions more about model structure and transformations. Also I was curious maybe you know, when you standardize the data should I standardize within each year or overall among all three years? – moku Jun 11 '15 at 17:53
• Ah! Then you would want to use an MMM, marketing mix model, and PTS is definitely the right way to go, imho. Others might argue for much more rigorously econometric "state-space" approaches. Peter Cain is one of them, browse his profile and publications on LinkedIn for more...but he's selling his expertise as much as anything. Cooper was writing in 1989 when R wasn't around. If you follow his prescriptions, the R modules would be the typical OLS regression tools. Standardizing by year would erase variation across years, don't do it. Consider mktg vehicle interactions. There's a big lit on MMMs – Mike Hunter Jun 11 '15 at 18:24

I would say that using a hierarchical model is suitable in your case.

Following this guide, BRAND would be your Level-2-term and Year could be your Level-1-term, used as random slope.

You should also check the ICC afterwards to see whether hierarchical models give you any benefits over normal linear regression.

• Oh cool this guide is really nice! So you recommend this formula: $lmer(Y ~ X1 + X2 + X3 + YEAR + (1 | BRAND), data=data)$ – moku Jun 11 '15 at 17:16
• I must admit that I'm no super-expert, so I suggest waiting for another answer "validating" my proposal. You could also add YEAR as random slope, but I would in any case include YEAR as term as you did in your formula. – Daniel Jun 11 '15 at 17:30

Yes, you should probably use multilevel modeling, possibly with company at level 3 and year at level 2. This would be a multilevel growth curve approach. You could then analyze the different kinds of changes in x different types of companies had over time.

• Ok cool could you explain the levels a bit more what does each level correspond to? For instance level 1 = normal term, level 2= random intercepts, level 3 = random slopes. – moku Jun 11 '15 at 17:18