# Mixed Effects Model - Some groups have a single value of x

I am working on sales of a B2B company and I have sales volumes of different customers at different price points. Some customers, however, purchased at only a single price point.

I'm trying to identify the effect of price on sales volume using a mixed-effects model (varying slope, varying intercept), where each customer is a "group"

Eg. Sales ~ Price + (1+Price|Customer)

My question is - What happens when certain customers have only one price point (ie. the independent variable does not change). Would these customers affect the fixed effect of 'Price' (do they bring the slope of the fixed effect closer to zero)? Is it more appropriate to remove these customers from my analysis?

• I would consider that the customers with only one price point do not yet have enough data for an analysis of variation. Oct 28 '18 at 13:34
• Thanks, @JamesPhillips, very helpful. Would this also be somehow related to why I'm getting a perfect correlation (= -1) between by random effects (the random effects slope and intercept)? Am I getting the perfect correlation because the model fails to converge because of this absence of variation? Oct 28 '18 at 13:43
• One way forward is to experiment. Try excluding all the ones with only one price point and compare the two sets of output carefully. Then if you still have further questions come back here and edit your question with a description of what you found. Interesting question (+1) Oct 28 '18 at 14:28

No, you do not have to exlcude the customers with one measurement. They still contribute to the cross-sectional effect of Price on Sales. This is also in relation to the potential missing data you may have, i.e., mixed models provide you with valid inferences under the missing at random assumption, and this requires to use all available data.
• The longitudinal effect is captured by the random effects. Even if a customer has a single measurement you see that you get an estimate for his/her slope (e.g., using the ranef() function) that it's not 0. Moreover, you can see that the estimated slopes of customers with one measurement will not be the same. That is, if two customers who had one measurements differ in the sales they had, you get a different slope for them. This is because the a-posteriori random intercepts and sloes are correlated, and being able to estimate the one you also get the other. Oct 29 '18 at 13:12