Skip to main content
Bumped by Community user
Tweeted twitter.com/StackStats/status/854975352644534272
Bumped by Community user
Bumped by Community user
Bumped by Community user
edited title
Link
conjugateprior
  • 21.3k
  • 2
  • 63
  • 90

When Whether to use hierarchala hierarchical linear modelsmodel

Source Link
moku
  • 323
  • 2
  • 4
  • 15

When to use hierarchal linear models

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?