1
$\begingroup$

I am having a hard time understanding how lme4 is fitting my data and am unsure if I am setting up my model correctly. I have very limited experience with mixed effect models.

My data is monthly sales records of a number of salespeople in various regions. I do not have the same amount of observations for each salespersons, and most salespersons' sales by month seem to be somewhat consistent.

What I am trying to do is determine what indicates a good salesperson. My independent variables are mostly factors and remain unchanged throughout all observations of each salesperson.

I fit a model with

lmer(sales ~ factor1 + ... + factorn + (1|id), data)

This does give me a response. However, I'm not sure how to interpret the coefficients. Especially since each salesperson is getting their own intercept and with very minimal changes in the sales each month and with factors remaining constant how is it estimating the factors effect?

I have a few other things I'm uncertain about as well.

Are uneven sample sizes an issue?

Should the salespeople be nested in their regions? So instead of (1|id) I'd put (1|region/id)?

How are these parameters being estimated?

Is there a better way to evaluate which factors indicate a good salesperson?

$\endgroup$
0

1 Answer 1

1
$\begingroup$

This is a lot of questions - ideally you should ask only one question per question that you post on StackExchange (including CrossValidated). However ...

Especially since each salesperson is getting their own intercept and with very minimal changes in the sales each month and with factors remaining constant how is it estimating the factors effect?

The covariates measure properties that are generalizable across salespersons and/or across time. The random effects try to capture the among-salesperson variability that is not explained by the covariates. It's not clear whether all your factors vary across subjects, across time, or both (you do say "with factors remaining constant", which suggests that all your factors are variable across subjects and constant over time). Factors that vary across time but are constant across all salespersons obviously can't give you any information about what makes a good salesperson - but they can help explain some of the variation in the data set, which makes your overall results stronger.

Are uneven sample sizes an issue?

No, except in extreme cases.

Should the salespeople be nested in their regions? So instead of (1|id) I'd put (1|region/id)?

As long as salespeople have unique IDs (i.e., there is only one "John Smith", not a "John Smith" from region 1 and another one from region 2) then you don't need to nest (see the glmm FAQ for more details); however, you might want to include region as a random effect, in which case (1|region/id) would make sense. (More ambitiously, you could allow for the effects of some covariates to vary across regions, e.g. (factor1|region) + (1|id) ....)

How are these parameters being estimated?

That's a long story.

Is there a better way to evaluate which factors indicate a good salesperson?

Maybe? Hard to say. Something simpler you could try is just to compute the average success over time of each salesperson, reducing the data set to a single observation per salesperson, then run a regular (lm) linear model ...

$\endgroup$
5
  • $\begingroup$ Thank you for your response. I have already averaged the sales across agents and have fit with lasso and elastic net. Those do give decent results. I am still a little curious about the repeated measures though. My features are constant across time but vary by salesperson like you guessed. You state that if they vary across time but are constant across salespeople then they can't be used to determine what makes a good salesperson. That makes sense. But what about in my case? Am I still able to use repeated measures? If each salesperson gets their own intercept I'd assume no. $\endgroup$ Commented Sep 6, 2016 at 20:54
  • $\begingroup$ Yes (as I tried to explain). $\endgroup$
    – Ben Bolker
    Commented Sep 6, 2016 at 20:55
  • $\begingroup$ But when I fit the model the results I got back seemed to line up with what I'd think intuitively, but I'm not sure how this was done. $\endgroup$ Commented Sep 6, 2016 at 20:55
  • $\begingroup$ The vignette in the lme4 package is rather technical. You could read Pinheiro and Bates (2000) ... I don't know offhand of an introduction to mixed models that is (1) mostly non-technical (2) short (3) available online for free. I wrote a paper in Trends in Ecology and Evolution (2008), and a book chapter with Fox et al in 2014, or you could look at section 4 of this chapter ... $\endgroup$
    – Ben Bolker
    Commented Sep 6, 2016 at 20:59
  • $\begingroup$ I have been reading Faraway's Extending the Linear Model with R. Unfortunately there is not much info on repeated measures, but there is some. The model as I have written it is of the form sales = $\beta_1$*$factor_1$ + ... + $\beta_n$*$factor_n$ + $\gamma_i$ + $\epsilon_{ij}$. where $\gamma_i$ is the $i^{th}$ salespersons intercept. If this is fit by estimating $\beta$ first then I guess I could understand how this will work. But I really don't see what is distinguishing the factor level effect from the salesperson effect. $\endgroup$ Commented Sep 6, 2016 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.