In the following exercise, we will model the amount deposited by clients, based on just two variables:
- The amount of time that each salesperson spent on the client
- The number of salespeople involved with the specific client
- We first load our dataset:
data = read.csv("./sample_random_regression.csv") data$clientid = as.factor(data$clientid) library("lme4")
- In order to practice with different formulations, let's start with the most complex one. Here, we have an intercept and two coefficients (one for each fixed effect). We then have a random effect for both the salespeople involved and the time spent on the deal. Because we added two terms for the parts involving the client IDs, we assume that the shocks impacting each ...