Week 9 Data Dive

My original regression model was examining the realtionship between the number of book units sold with their sale price. Although this model would be useful in seeing if a change in sale price could cause a change in the total number of units sold, there are many other regression models that could be created to get an idea on what combination of variables strongly effect units sold. In this new regression mode, I am including Author Rating, Book Average Rating, and Publisher on top of Sales Price.

Linear Model

Author Rating is a categorical column that ranks the author from novice to famous. By including this, we can see if an author’s reputation has any impact on book units sold.

By including Book Average rating, a numerial continuous column, we can get an idea on if the reader-perceived quality of the book will impact the number of units sold.

Finally, by including the Publisher, we can get an idea on how much influence the publsiher has on units sold. Does a large publisher such as Amazon, who does not have any specific criteria for the books they sell, tend to sell more or less units of a book than a smaller but more specialized publisher?

lm_multiple <- lm(`units sold` ~ `sale price` + Author_Rating + Book_average_rating + Publisher, data = book_sales)

summary(lm_multiple)
## 
## Call:
## lm(formula = `units sold` ~ `sale price` + Author_Rating + Book_average_rating + 
##     Publisher, data = book_sales)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -16434  -8611  -5612  -2245  54111 
## 
## Coefficients:
##                                                Estimate Std. Error t value
## (Intercept)                                    62927.75   12007.08   5.241
## `sale price`                                      11.29     157.17   0.072
## Author_RatingFamous                            -3546.76    2358.32  -1.504
## Author_RatingIntermediate                      -8520.77    1245.24  -6.843
## Author_RatingNovice                           -15719.04    3667.22  -4.286
## Book_average_rating                           -11799.70    2869.30  -4.112
## PublisherHachette Book Group                   -1940.62    2018.67  -0.961
## PublisherHarperCollins Publishers              -2307.48    1866.14  -1.236
## PublisherMacmillan                             -1961.40    2456.54  -0.798
## PublisherPenguin Group (USA) LLC               -1312.45    1795.56  -0.731
## PublisherRandom House LLC                       1030.86    1642.28   0.628
## PublisherSimon and Schuster Digital Sales Inc   -931.93    2148.45  -0.434
##                                               Pr(>|t|)    
## (Intercept)                                   1.93e-07 ***
## `sale price`                                     0.943    
## Author_RatingFamous                              0.133    
## Author_RatingIntermediate                     1.31e-11 ***
## Author_RatingNovice                           1.98e-05 ***
## Book_average_rating                           4.22e-05 ***
## PublisherHachette Book Group                     0.337    
## PublisherHarperCollins Publishers                0.217    
## PublisherMacmillan                               0.425    
## PublisherPenguin Group (USA) LLC                 0.465    
## PublisherRandom House LLC                        0.530    
## PublisherSimon and Schuster Digital Sales Inc    0.665    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 15070 on 1058 degrees of freedom
## Multiple R-squared:  0.04897,    Adjusted R-squared:  0.03908 
## F-statistic: 4.952 on 11 and 1058 DF,  p-value: 1.553e-07

Out of the variables that were examined in order to understand their role in book units sold, there was not enough data to conclude that the Publisher has much of an impact on units sold, due to the high P-values. On the other hand, it is reasonable to assume that author rating and average book rating has some significance to the number of books that get sold.

##Evaluating Model

###Diagnostic Plot 1

#residuals vs. fitted values plot
plot(lm_multiple, which=1, main="Residuals vs. Fitted")

The purpose of a residuals vs. fitted plot is to show how the differences between the predicted values and residuals change as the predicted values change. In the plot above, there are a lot of residuals evenly scattered across the line, but there are quite a few values that are not very close to the line. This makes me believe that there may be some variability that isn’t being properly captured, or there could be some sort of bias or error.

###Diagnostic Plot 2

#normal Q-Q plot
plot(lm_multiple, which=2, main="Normal Q-Q Plot")

This Q-Q plot is supposed to help identify if the residuals follow normal distribution. The plot follows a somewhat normal distribution up until the 1st theoretical quantile, and after that it begins to curve quite a bit. This leads me to believe that there is some skew in the distribution of my residuals.

###Diagnostic Plot 3

plot(lm_multiple, which=3, main="Scale-Location Plot")

The scale-location plot is a bit similar to the residual vs. fitted plot, but focuses more on identifying if the spread of residuals is consistent across the predicted values. The result of this is also pretty similar to the residual vs. fitted plot. A lot of the values do seem to have a pretty constant variance across the predicted values, but there still is some variability.

###Diagnostic Plot 4

plot(lm_multiple, which=5, main="Residuals vs. Leverage")

The residual vs. leverage plot helps identify points with high impact on the model based on their leverage. There are quite a few points that are pretty far above the line, but there are a few particularly high influential points that have been labeled.

###Diagnostic Plot 5

# Cook's Distance Plot
par(mfrow=c(1,1))
plot(lm_multiple, which=4, main="Cook's Distance Plot")

The cook’s distance plot is similar to the leverage plot but provides a slightly different perspective. There are a few labeled points that seem to be highly influential on the model.

After running these evaluations, I do not think my model is quite optimal. It seems to suffer from variance in the residual spread and a bit of inconsistency. The irregularities in my evaluation plots indicate that there is definitely futher investigation to be done.