There's more... 

After a model has been fitted, it is important to analyze the residuals. We need to take some extra care because the data will belong to groups. Thus, we need to do a separate analysis for each group:

plot(model, resid(., scaled=TRUE) ~ fitted(.) | clientid, abline = 0) 

The following output shows the fitted versus the residuals. These look good, and there is no obvious traces of structure here:

Then, type the following code:

plot(model, clientid ~ resid(., scaled=TRUE)) 

The following output shows the scaled residuals for each group:

In the previous two plots, we first showed the fitted-residual relationship; ideally, there should be no structure there. As you can see, there is no obvious structure there. We then plotted boxplots for the residuals in each group. Again, there is nothing particularly interesting. 

Now, let's plot the fitted versus the actuals. There should be a positive linear relationship here. If this weren't the case, it would imply that we were missing some structure in the model:

plot (model, deal_size ~ fitted(.) | clientid, abline = c (0,1)) 

The following screenshot shows that the fitted versus the actuals doesn't present any obvious problems:

Finally, we can print both the sales people-residuals and time spent-residuals. The same concept should be applied here—there should not be any structure appearing here:

plot(model, resid(., scaled=TRUE) ~ salespeople_involved | clientid, abline = 0) 

Take a look at the following screenshot:

Type the following code:

plot(model, resid(., scaled=TRUE) ~ time_spent_deal | clientid, abline = 0) 

Take a look at the following screenshot:

A model should essentially leave no missing structure in the residuals, and this is actually the same thing we should check for in a simple OLS model. The only difference here is that we have done our analysis for each subject.

Even though we haven't tested whether the residuals are Gaussian, it needs to be checked as well. This should be checked both for the residuals, and the residuals within each group. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.231.15