# 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. Commented Oct 28, 2018 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? Commented Oct 28, 2018 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) Commented Oct 28, 2018 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.

Regarding the perfect correlation, try working with the centered prices.

• Thanks, @Dimitris. Could you shed more light on how customers with only one price point "contribute to the cross-sectional effect of Price on Sales"? Do they contribute by bringing the slope closer to zero (because their slopes are zero)? Note that customers with one price point can still have multiple measurements (at the same price point, but varying sales, measured in different months). My mixed effect model has varying slope and intercept for each customer. Commented Oct 29, 2018 at 11:54
• Say that you have only customers with one measurement, then you could a simple linear regression with Price as the covariate and Sales as the outcome, and see via the corresponding coefficients how strongly related the two are. This is the cross-sectional effect, and this is what you also get as the fixed-effect regression coefficient from the mixed model. The difference between the mixed model and linear regression will be that in the former you correctly account for the correlations in the repeated measurements of customers who have more than one. Commented Oct 29, 2018 at 13:07
• 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. Commented Oct 29, 2018 at 13:12