# Multilevel Model Application / Specification

I have some multilevel-data-structure, where I want to regress top 10 music chart listings (dependent variables: downloads and rank) on some song characteristics (Xi). The problem for me now comes from my specific setting where I want to use top 10 charts from different countries and for different months. So as far I understand multilevel modelling I have to cluster the individual entries into the corresponding countries (top 10 chart entry nested in country top 10 charts). So basically my data structure is:

Country Song-ID Rank    Downloads    X1               X2           X3       …   Month
USA        a    1        100000   male_singer    indie_label    Award_yes       January
USA        b    2         90000   female_singer  major_label    Award_no        January
USA        c    3         80000   male_singer    major_label    Award_yes       January
…
China      b    1        150000  female_singer   major_laber    Award_no        January
China      a    2         80000   male_singer    indie_label    Award_yes       January
China      d    3         45000  female_singer   indie_label    Award_yes       January
…
S.Africa   c    1         75000    male_singer   major_label    Award_yes       February
S.Africa   d    2         55000   female_singer  indie_label    Award_yes       February
S.Africa   a    3         40000    male_singer   indie_label    Award_yes       February
…


As far as I understand this relates to multiple membership and/or a crossed level setting. But what gives me a real headache is how to treat the possible multiple outcomes for the individual songs.

I wanted to try out brms/lme4 in R and from the according manuals and help files I figured out how to use them (also for the multiple membership case). But as I stated, the possibility of different outcome variables confuses me a lot. I´m absolutely not sure if my approach of using a multilvel model is adequate and also how to write down the corresponding formulas in these packages or how to set up an adequate dataframe for this analysis.

I think you have to go with a single dependent variable. I would advise using the number of downloads as the dependent variable and explore how the albums are ranked. If they're ranked by number of downloads, then the logic is circular. As for a function, I would use

m1 <- lmer(Downloads~ X1 + X2 + X3 + Month + (1 | Country ), data = mydata, REML= FALSE)

Remember that the lme4 is limited in that it represents individual-level and group-level variable side-by-side in the function. For example, X3 can be a group-level effect (some aspect of the country) or an individual level effect (some feature of the song). Structurally, this means that the data all has to be in one dataset, just like the one you have.

If you want varying slopes (ex. China likes male singers more than USA), then use:

m2 <- lmer(Downloads~ X1 + X2 + x3 + Month + (1 + X1 | Country), data = mydata, REML = FALSE)

• okay this is a very helpful hint. But if it´s okay, I want to ask you if it is a problem in my data that song a has basically two entries in two entries with varying response variables Yij (Downloads in USA and China) but (of cource) similar song variables Xi. This really worries me. Should every entry be seen as individual observation nested in songs and then nested in countries or should I dont mind about this? For me, the standard multilevel examples doesn´t explain this case. Any help or source would be highly appreciatd by me. Thank you Commented Aug 22, 2018 at 12:11
• You do not need to nest within songs because the song is the lowest level of the data. By analogy if you're doing an experiment to test the efficacy of a pharmaceutical, which is manufactured in several different manufacturing plants, and you want to control for differences in manufacturing plants, you would nest pills within each plant, but not within each pill. This example comes from Ott and Longnecker, Intro to Statistical Methods and Data Analysis. Commented Aug 22, 2018 at 13:31
• What you would want to do is include an ID for each song. m3 <- lmer(Downloads~ X1 + X2 + x3 + Month + Song-ID + (1 + X1 | Country), data = mydata, REML = FALSE) Commented Aug 22, 2018 at 13:32