I'm new to mixed effects modeling and definitely lme4 and would greatly appreciate some advice.
My research question: what factors determine a business' number of online reviews per day?
The data is cross-sectional and the observations are businesses.
Dependent variable : number of online reviews (interested in its ratio = number of reviews per day)
Independent variables are either business-related or location-related as shown in the table below. Except concentration, location factors are not of interest to me and are included as controls.
Here's a sample of 4 rows of the data. There are a few more variables related to the businesses and locations which I’m leaving out for brevity:
Since one of my focal independent variables (concentration of competitors) is at zip code level and these businesses are nested in zip codes (and thus can share concentration values), I've decided to use mixed effect models with zip code as random effect. Also, since the dependent variable is count, I've decided to go with either Poisson or negative binomial regression with the span of online reviews in days as offset. I'm using lme4 in R and my questions mainly revolve around my formula below and if it is sound or not.
Formula: number of online reviews ~ price * concentration + number of services provided + offset(log of time span of online reviews) + (1|zipcode) + (1|price)
One of my main intended theoretical contributions is to highlight how the effects of different factors depend on locational-factors especially concentration. Does my formula (specifically 1|zipcode) accurately reflect that? I will note that the concentration variable has a very limited range (75% if data points are between 0 and 4) so I could not categorize it into numerous categories to use it as a random effect separate from zipcode).
Feel free to address any other concerns you see or even rewrite the formula to clear things up for me.
price
as both a fixed and a random effect? $\endgroup$price
as part of the random effect forzipcode
, which in your current model only provides a random intercept. See the lmer cheat sheet for different ways to do that, depending on your assumptions, withprice
as the fixed effect in those examples. $\endgroup$zipcode
and within-zipcode
correlations. Note that(1+price|zipcode)
imposes a correlation between the random intercepts and slopes; see this answer for how to remove that restriction if appropriate. $\endgroup$