How to do it...

In this recipe, we will work with the same dataset that we used before. It contains clientid, deal_size, salespeople_involved, and time_spent_deal. deal_size is the target variable, and the two variables that we have are the number of salespeople involved and the time spent on each deal. Both are expected to have a positive effect on the deal size.

  1. We first load the necessary dataset and libraries:
library(dplyr) library("lme4") library(ggplot2) data = read.csv("/sample_random_regression.csv") data$clientid = as.factor(data$clientid) 
  1. A useful initial plot, which is usually used in the context of mixed models, is one that shows the dependent variable versus each independent variable faceted by subject. This can be used ...

Get R Statistics Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.