The Makings of a Bestselling Author

Introduction

Within the world of literature, that status of “bestselling author” is one that brings recognition, acclaim, and financial success for both authors and the publishers that represent them, but what factors distinguish top-selling authors from all others? Is it pure luck, or is there strategy to their success?

In this study, we will use statistical analyses to examine renowned authors, and what exactly sets them apart from less successful authors.

By identifying the success factors of affluent authors, aspiring authors can use these insights to forge their own paths towards success. Furthermore, publishers can utilize this analysis to create strategies to support their authors.

Descriptive Statistics

summary(book_sales)
##      index        Publishing Year  Book Name            Author         
##  Min.   :   0.0   Min.   :-560    Length:1070        Length:1070       
##  1st Qu.: 267.2   1st Qu.:1985    Class :character   Class :character  
##  Median : 534.5   Median :2003    Mode  :character   Mode  :character  
##  Mean   : 534.5   Mean   :1971                                         
##  3rd Qu.: 801.8   3rd Qu.:2010                                         
##  Max.   :1069.0   Max.   :2016                                         
##                   NA's   :1                                            
##  language_code      Author_Rating      Book_average_rating Book_ratings_count
##  Length:1070        Length:1070        Min.   :2.970       Min.   : 27308    
##  Class :character   Class :character   1st Qu.:3.850       1st Qu.: 70398    
##  Mode  :character   Mode  :character   Median :4.015       Median : 89309    
##                                        Mean   :4.007       Mean   : 94910    
##                                        3rd Qu.:4.170       3rd Qu.:113906    
##                                        Max.   :4.770       Max.   :206792    
##                                                                              
##     genre            gross sales      publisher revenue   sale price   
##  Length:1070        Min.   :  104.9   Min.   :    0.0   Min.   : 0.99  
##  Class :character   1st Qu.:  372.5   1st Qu.:    0.0   1st Qu.: 1.99  
##  Mode  :character   Median :  809.7   Median :  273.1   Median : 3.99  
##                     Mean   : 1856.6   Mean   :  843.3   Mean   : 4.87  
##                     3rd Qu.: 1488.0   3rd Qu.:  721.2   3rd Qu.: 6.99  
##                     Max.   :47795.0   Max.   :28677.0   Max.   :33.86  
##                                                                        
##    sales rank      Publisher           units sold     
##  Min.   :   1.0   Length:1070        Min.   :  106.0  
##  1st Qu.: 287.5   Class :character   1st Qu.:  551.2  
##  Median : 595.5   Mode  :character   Median : 3924.0  
##  Mean   : 611.7                      Mean   : 9677.0  
##  3rd Qu.: 932.5                      3rd Qu.: 5312.2  
##  Max.   :1273.0                      Max.   :61560.0  
## 

The data set consists of 1,070 books and 15 features. A few of the features included are publishing year, author, ratings, genre, sales data, along with others. The data set provides details pertaining to the characteristics of each book along with how well they have performed. Furthermore, author and publisher data is provided as well.

Author Stats

I wish to explore the differences between the top authors, or “bestselling” authors in this data set compared to authors who have not performed as well. To begin this process, I need to define what exactly it takes to be considered a bestselling author. The factors I believe to be the biggest indicator of the success of a book are:

  • Units Sold

  • Gross Sales

#calculate the total gross sales, total units sold, and number of books published for each author
author_stats <- book_sales |>
  group_by(Author) |>
  summarise(total_gross_sales = sum(`gross sales`),
            total_units_sold = sum(`units sold`),
            num_books_published = n_distinct(`Book Name`))
            

author_stats <- author_stats |>
  mutate(avg_gross_sales = total_gross_sales / num_books_published)

author_stats <- author_stats |>
  mutate(avg_units_sold = total_units_sold / num_books_published)

print (head(author_stats))
## # A tibble: 6 × 6
##   Author  total_gross_sales total_units_sold num_books_published avg_gross_sales
##   <chr>               <dbl>            <dbl>               <int>           <dbl>
## 1 A.A. M…              215.              108                   1            215.
## 2 A.S.A.…              784.            28728                   1            784.
## 3 Abbi G…             2990.            30782                   2           1495.
## 4 Adam J…              109.             4320                   1            109.
## 5 Adam M…              114.             2916                   1            114.
## 6 Aesop,…              694.            53784                   1            694.
## # ℹ 1 more variable: avg_units_sold <dbl>

With the new author_stats tibble, I have grouped the book sales by each author and created a few new columns. First, I have calculated their total gross sales and total units sold across all of their books. Next, I calculated the average of their gross sales and average of their units sold per the number of books published.

It is important to also look at the average of gross sales and units sold for each book published because only looking at the totals for each author may give a false impression of success, especially if an author has a large number of books in their portfolio. Looking at the gross totals for an author who has published many (but poor performing) books, could possibly overshadow an author who has only published 1-2 books that performed really well.

Finding Top and Bottom Authors

Now that the author stats have been created, I now need to identify my top authors and bottom authors. Due to the size of my original data set, I will be examining the top 10% and bottom 10%. Furthermore, I need to identify which feature I would like to base the top and bottom authors on.

#create threshold for the top and bottom 10% based on total gross sales
top_threshold <- quantile(author_stats$total_gross_sales, probs = 0.90)
bottom_threshold <- quantile(author_stats$total_gross_sales, probs = 0.10)

#subset the top 1% and bottom 1% of authors
top_10_percent_authors <- author_stats |>
  filter(total_gross_sales >= top_threshold) |>
  arrange(desc(total_gross_sales))

bottom_10_percent_authors <- author_stats |>
  filter(total_gross_sales <= bottom_threshold) |>
  arrange(desc(total_gross_sales))

print("Top 10% of Authors by Aggregated Gross Sales:")
## [1] "Top 10% of Authors by Aggregated Gross Sales:"
print(top_10_percent_authors)
## # A tibble: 74 × 6
##    Author total_gross_sales total_units_sold num_books_published avg_gross_sales
##    <chr>              <dbl>            <dbl>               <int>           <dbl>
##  1 Harpe…            47795              5500                   1          47795 
##  2 Steph…            43323.           278322                  29           1494.
##  3 David…            42323.            15193                   3          14108.
##  4 Charl…            39453.            47249                  10           3945.
##  5 Laini…            38278.             8990                   2          19139.
##  6 Unkno…            34160              7000                   1          34160 
##  7 Sarah…            31035.            42832                   5           6207.
##  8 Colle…            30882.           123522                   7           4412.
##  9 C.S. …            28973.             8381                   3           9658.
## 10 Brand…            28877.            53460                   7           4125.
## # ℹ 64 more rows
## # ℹ 1 more variable: avg_units_sold <dbl>
print("Bottom 10% of Authors by Aggregated Gross Sales:")
## [1] "Bottom 10% of Authors by Aggregated Gross Sales:"
print(bottom_10_percent_authors)
## # A tibble: 74 × 6
##    Author total_gross_sales total_units_sold num_books_published avg_gross_sales
##    <chr>              <dbl>            <dbl>               <int>           <dbl>
##  1 Willi…              221.             4400                   1            221.
##  2 Chaim…              219.             4320                   1            219.
##  3 Ruth …              218.             8640                   2            109.
##  4 Lewis…              217.             4280                   1            217.
##  5 A.A. …              215.              108                   1            215.
##  6 Joe H…              215.             5859                   1            215.
##  7 James…              212               106                   1            212 
##  8 Eliza…              206.             5616                   1            206.
##  9 Kimbe…              199.             5427                   1            199.
## 10 Susan…              194.             5292                   1            194.
## # ℹ 64 more rows
## # ℹ 1 more variable: avg_units_sold <dbl>

Comparing the Best Performing to the Worst Performing (Based on Gross Sales)

#very top author
top_author <- top_10_percent_authors$Author[1]
top_author_data <- book_sales[book_sales$Author == top_author, ]

#very bottom author
bottom_author <- bottom_10_percent_authors$Author[1]
bottom_author_data <- book_sales[book_sales$Author == bottom_author, ]

#compare
top_author_stats <- author_stats[author_stats$Author == top_author, ]
bottom_author_stats <- author_stats[author_stats$Author == bottom_author, ]

print(top_author_stats)
## # A tibble: 1 × 6
##   Author  total_gross_sales total_units_sold num_books_published avg_gross_sales
##   <chr>               <dbl>            <dbl>               <int>           <dbl>
## 1 Harper…             47795             5500                   1           47795
## # ℹ 1 more variable: avg_units_sold <dbl>
print(bottom_author_stats)
## # A tibble: 1 × 6
##   Author  total_gross_sales total_units_sold num_books_published avg_gross_sales
##   <chr>               <dbl>            <dbl>               <int>           <dbl>
## 1 Willia…              221.             4400                   1            221.
## # ℹ 1 more variable: avg_units_sold <dbl>

Top vs. Bottom Authors

Now that the top 10% and bottom 10% of authors have been identified, I want to take a deep dive on these two subsets. First, I will be examining sales performance by taking the averages of the sales performance features for the top authors and bottom authors.

Sales Performance

#calculate the averages for each metric
top_average <- colMeans(top_10_percent_authors[, c("total_gross_sales", 
                                                  "total_units_sold", 
                                                  "avg_gross_sales", 
                                                  "avg_units_sold")])
bottom_average <- colMeans(bottom_10_percent_authors[, c("total_gross_sales", 
                                                        "total_units_sold", 
                                                        "avg_gross_sales", 
                                                        "avg_units_sold")])

#create df for comparing
comparison_data <- data.frame(
  Metric = c("Total Gross Sales ($)", 
             "Total Units Sold", 
             "Average Gross Sales per Book ($)", 
             "Average Units Sold per Book"),
  Top_Authors = top_average,
  Bottom_Authors = bottom_average
)

#wes anderson color palette
wes_palette <- wes_palette("Darjeeling1")

#reshape the data frame to make easier to plot
comparison_data_long <- pivot_longer(comparison_data, -Metric)

#side by side bar charts
ggplot(comparison_data_long, aes(x = Metric, y = value, fill = name)) +
  geom_bar(stat = "identity", position = "dodge", width = 0.7) +
  labs(title = "Comparison of Top and Bottom Authors",
       x = "Metric",
       y = "Average",
       fill = "Author Type") +
  theme_minimal() +
  theme(legend.position = "top",
        axis.text.x = element_text(angle = 45, hjust = 1)) +
  scale_fill_manual(values = wes_palette)

The top 10% of authors dominated in average gross sales per book, total gross sales and total units sold, but interestingly enough, it was found that the bottom 10% of authors on average sold more units per book than the top authors.

Price Comparison

Due to the interesting finding of the bottom 10% of authors getting more units sold per book on average compared to the top 10% of authors, I became interested in looking at the sales prices between the two authors groups. To examine this, I created side-by-side box plots to examine the distribution of the book prices.

#getting book sales price for top authors
top_author_prices <- book_sales |>
  filter(Author %in% top_10_percent_authors$Author) |>
  pull(`sale price`)

#getting book sales price for bottom authors
bottom_author_prices <- book_sales |>
  filter(Author %in% bottom_10_percent_authors$Author) |>
  pull(`sale price`)

price_comparison <- data.frame(
  Price = c(top_author_prices, bottom_author_prices),
  Author = rep(c("Top Authors", "Bottom Authors"), 
               c(length(top_author_prices), length(bottom_author_prices)))
)

ggplot(price_comparison, aes(x = Author, y = Price, fill = Author)) +
  geom_boxplot() +
  labs(title = "Comparison of Book Prices between Top 10% and Bottom 10% Authors",
       x = "Author Group",
       y = "Sale Price") +
  theme_minimal()

Looking at the box plots for book prices between the top 10% of authors and bottom 10% of authors, there is a very stark difference in the book pricing between the top and bottom authors. The authors on the lower end of the scale have much lower average of book price, and also have a much smaller range of book prices. Authors on the higher end of the scale have a higher average book price, and also have a much wider range of book prices.

Performing a Two-Sample T-Test

Due to the obvious visual differences in the book sales prices between the top and bottom authors. I opted to perform a Two-Sample T-Test to determine if the sales price is indeed a significant factor between being a best-selling author and being an under-performing author.

t_test_result <- t.test(top_author_prices, bottom_author_prices)

print(t_test_result)
## 
##  Welch Two Sample t-test
## 
## data:  top_author_prices and bottom_author_prices
## t = 18.495, df = 247.18, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  4.235200 5.244735
## sample estimates:
## mean of x mean of y 
##  5.796901  1.056933

The Two-Sample T-Test determined that mean of book price for the top 10% of authors (x) is about 5.8, while the mean of book price for the bottom 10% of authors is about 1. The found p-value of 2.2e^-16 indicates that there is strong evidence that there is a significant difference between the mean book prices between top authors and the bottom authors. Furthermore, the t-value of about 18.5 also supports the assumption that there is a substantial difference in the book sales price between the two author groups.

Comparing Publisher Distributions

Now that some of the numerical sales data has been analyzed, I wanted to switch my focus and examine categorical data. The publisher feature was very interesting to me, and I believe that this could possibly provide further insight into the differences between the top 10% of authors and the bottom 10% of authors.

#get publisher data for top authors
top_publisher_distribution <- book_sales |>
  filter(Author %in% top_10_percent_authors$Author) |>
  count(Publisher) |>
  mutate(Percentage = n / sum(n))

#get publisher data for bottom authors
bottom_publisher_distribution <- book_sales |>
  filter(Author %in% bottom_10_percent_authors$Author) |>
  count(Publisher) |>
  mutate(Percentage = n / sum(n))

#combine into one data frame for visualization
combined_publisher_distribution <- bind_rows(
  mutate(top_publisher_distribution, Group = "Top Authors"),
  mutate(bottom_publisher_distribution, Group = "Bottom Authors")
)

#bar charts for visual comparison
ggplot(combined_publisher_distribution, aes(x = reorder(Publisher, -n), y = n, fill = Group)) +
  geom_bar(stat = "identity", position = "dodge") +
  labs(title = "Frequencies of Publishers Between Author Groups",
       x = "Publisher",
       y = "Frequency") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1),
        legend.position = "top") +
  scale_fill_manual(values = c("Top Authors" = my_palette[2], "Bottom Authors" = my_palette[1]))

Looking at the frequencies of publishers between top and bottom authors, the visualization does reveal a few interesting findings. Though the top 10% of authors seem to most frequently go through Amazon Digital Services, Inc. for their publishing, there is still are still many books being published through other publishers. The bottom 10% authors on the other hand, seem to mostly only go through Amazon for publishing. There are a few books from the bottom authors that were published through Random House LLC, Simon and Schuster Digital Sales Inc., and Macmillan. Moreover, no books were published through Penguin Group LLC, HarperCollins or the Hachette Book Group from the lower end authors.

This begs a bit more questioning. The frequency of the publishers does not indicate the revenue or units sold generated from each book. It is possible that although Amazon is the most frequent, it may not be generating a lot of sales. Furthermore, it is also possible that the top selling authors could start their careers with a more specialized publisher, and then move to a more general publisher such as Amazon once they grow their reputation.

This has prompted me to explore how influential the publisher is for gross sales and units sold. Moreover, I wish to explore how different authors and books would perform if a different publisher was used.

Deep Dive into Publishers
Do Publishers Affect Sales?

To first examine the effect of publishers on the factors that determine bestselling authors, I will conduct ANOVA testing. First, I will examine if the publisher has an effect on gross sales and units sold for the entirety of the data set.

anova_sales_metrics <- aov(cbind(`gross sales`, `units sold`) ~ Publisher, 
                           data = book_sales)
summary(anova_sales_metrics)
##  Response gross sales :
##               Df     Sum Sq   Mean Sq F value    Pr(>F)    
## Publisher      6 8.1389e+08 135647570  9.1523 8.709e-10 ***
## Residuals   1063 1.5755e+10  14821208                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
##  Response units sold :
##               Df     Sum Sq   Mean Sq F value Pr(>F)
## Publisher      6 8.5891e+08 143152133  0.6046 0.7269
## Residuals   1063 2.5170e+11 236779969

Looking at the entire data set, the ANOVA test indicates that the publisher does significantly impact gross sales, meaning that there are very noticeable differences in gross sales across the different publishers in the set.

Contrary to gross sales, the ANOVA test for units sold has a very different result. The test indicates that there is not enough data to conclude that there is a significant difference in the units sold across publishers.

Since gross sales was impacted by the publisher, I chose to examine it’s relationship to publisher more. Upon research, I came across a test called Tukey’s Honestly Significant Difference (HSD) test, which is meant to be performed after an ANOVA. Tukey’s HSD will compare all of the means of publishers to each other and identify which specific pairs have significant differences. I thought that this would be very beneficial in increasing my understanding of how different publishers may effect sales.

#recreating anova for gross sales
anova_gross_sales <- aov(`gross sales` ~ Publisher, data = book_sales)

#tukey's HSD test
tukey_test <- TukeyHSD(anova_gross_sales, "Publisher")

#convert to data frame for readability
tukey_results <- as.data.frame(tukey_test$`Publisher`)

#round the values for better readability
tukey_results <- round(tukey_results, digits = 2)

#sorting by diff
tukey_results <- tukey_results[order(-abs(tukey_results$diff)), ]

print(tukey_results)
##                                                                         diff
## Hachette Book Group-Amazon Digital Services,  Inc.                   2265.33
## Macmillan-Hachette Book Group                                       -2166.39
## Penguin Group (USA) LLC-Amazon Digital Services,  Inc.               2083.30
## Simon and Schuster Digital Sales Inc-Hachette Book Group            -2083.22
## Penguin Group (USA) LLC-Macmillan                                    1984.36
## Simon and Schuster Digital Sales Inc-Penguin Group (USA) LLC        -1901.19
## HarperCollins Publishers-Amazon Digital Services,  Inc.              1598.94
## Macmillan-HarperCollins Publishers                                  -1500.00
## Simon and Schuster Digital Sales Inc-HarperCollins Publishers       -1416.83
## Random House LLC-Amazon Digital Services,  Inc.                      1416.78
## Random House LLC-Macmillan                                           1317.83
## Simon and Schuster Digital Sales Inc-Random House LLC               -1234.67
## Random House LLC-Hachette Book Group                                 -848.55
## Random House LLC-Penguin Group (USA) LLC                             -666.52
## HarperCollins Publishers-Hachette Book Group                         -666.39
## Penguin Group (USA) LLC-HarperCollins Publishers                      484.36
## Random House LLC-HarperCollins Publishers                            -182.16
## Simon and Schuster Digital Sales Inc-Amazon Digital Services,  Inc.   182.11
## Penguin Group (USA) LLC-Hachette Book Group                          -182.03
## Macmillan-Amazon Digital Services,  Inc.                               98.95
## Simon and Schuster Digital Sales Inc-Macmillan                         83.17
##                                                                          lwr
## Hachette Book Group-Amazon Digital Services,  Inc.                    790.51
## Macmillan-Hachette Book Group                                       -4427.79
## Penguin Group (USA) LLC-Amazon Digital Services,  Inc.                894.58
## Simon and Schuster Digital Sales Inc-Hachette Book Group            -4149.38
## Penguin Group (USA) LLC-Macmillan                                    -101.77
## Simon and Schuster Digital Sales Inc-Penguin Group (USA) LLC        -3773.88
## HarperCollins Publishers-Amazon Digital Services,  Inc.               237.82
## Macmillan-HarperCollins Publishers                                  -3688.95
## Simon and Schuster Digital Sales Inc-HarperCollins Publishers       -3403.43
## Random House LLC-Amazon Digital Services,  Inc.                       279.54
## Random House LLC-Macmillan                                           -739.39
## Simon and Schuster Digital Sales Inc-Random House LLC               -3075.11
## Random House LLC-Hachette Book Group                                -2591.34
## Random House LLC-Penguin Group (USA) LLC                            -2174.92
## HarperCollins Publishers-Hachette Book Group                        -2562.87
## Penguin Group (USA) LLC-HarperCollins Publishers                    -1199.27
## Random House LLC-HarperCollins Publishers                           -1829.84
## Simon and Schuster Digital Sales Inc-Amazon Digital Services,  Inc. -1406.92
## Penguin Group (USA) LLC-Hachette Book Group                         -1958.84
## Macmillan-Amazon Digital Services,  Inc.                            -1736.80
## Simon and Schuster Digital Sales Inc-Macmillan                      -2254.33
##                                                                         upr
## Hachette Book Group-Amazon Digital Services,  Inc.                  3740.16
## Macmillan-Hachette Book Group                                         95.02
## Penguin Group (USA) LLC-Amazon Digital Services,  Inc.              3272.03
## Simon and Schuster Digital Sales Inc-Hachette Book Group             -17.05
## Penguin Group (USA) LLC-Macmillan                                   4070.48
## Simon and Schuster Digital Sales Inc-Penguin Group (USA) LLC         -28.49
## HarperCollins Publishers-Amazon Digital Services,  Inc.             2960.06
## Macmillan-HarperCollins Publishers                                   688.96
## Simon and Schuster Digital Sales Inc-HarperCollins Publishers        569.77
## Random House LLC-Amazon Digital Services,  Inc.                     2554.02
## Random House LLC-Macmillan                                          3375.06
## Simon and Schuster Digital Sales Inc-Random House LLC                605.78
## Random House LLC-Hachette Book Group                                 894.24
## Random House LLC-Penguin Group (USA) LLC                             841.87
## HarperCollins Publishers-Hachette Book Group                        1230.10
## Penguin Group (USA) LLC-HarperCollins Publishers                    2167.99
## Random House LLC-HarperCollins Publishers                           1465.52
## Simon and Schuster Digital Sales Inc-Amazon Digital Services,  Inc. 1771.15
## Penguin Group (USA) LLC-Hachette Book Group                         1594.79
## Macmillan-Amazon Digital Services,  Inc.                            1934.69
## Simon and Schuster Digital Sales Inc-Macmillan                      2420.66
##                                                                     p adj
## Hachette Book Group-Amazon Digital Services,  Inc.                   0.00
## Macmillan-Hachette Book Group                                        0.07
## Penguin Group (USA) LLC-Amazon Digital Services,  Inc.               0.00
## Simon and Schuster Digital Sales Inc-Hachette Book Group             0.05
## Penguin Group (USA) LLC-Macmillan                                    0.07
## Simon and Schuster Digital Sales Inc-Penguin Group (USA) LLC         0.04
## HarperCollins Publishers-Amazon Digital Services,  Inc.              0.01
## Macmillan-HarperCollins Publishers                                   0.40
## Simon and Schuster Digital Sales Inc-HarperCollins Publishers        0.35
## Random House LLC-Amazon Digital Services,  Inc.                      0.00
## Random House LLC-Macmillan                                           0.49
## Simon and Schuster Digital Sales Inc-Random House LLC                0.43
## Random House LLC-Hachette Book Group                                 0.78
## Random House LLC-Penguin Group (USA) LLC                             0.85
## HarperCollins Publishers-Hachette Book Group                         0.95
## Penguin Group (USA) LLC-HarperCollins Publishers                     0.98
## Random House LLC-HarperCollins Publishers                            1.00
## Simon and Schuster Digital Sales Inc-Amazon Digital Services,  Inc.  1.00
## Penguin Group (USA) LLC-Hachette Book Group                          1.00
## Macmillan-Amazon Digital Services,  Inc.                             1.00
## Simon and Schuster Digital Sales Inc-Macmillan                       1.00
# Extract top 5 pairs
top_5_pairs <- tukey_results[1:5, ]

print(top_5_pairs)
##                                                              diff      lwr
## Hachette Book Group-Amazon Digital Services,  Inc.        2265.33   790.51
## Macmillan-Hachette Book Group                            -2166.39 -4427.79
## Penguin Group (USA) LLC-Amazon Digital Services,  Inc.    2083.30   894.58
## Simon and Schuster Digital Sales Inc-Hachette Book Group -2083.22 -4149.38
## Penguin Group (USA) LLC-Macmillan                         1984.36  -101.77
##                                                              upr p adj
## Hachette Book Group-Amazon Digital Services,  Inc.       3740.16  0.00
## Macmillan-Hachette Book Group                              95.02  0.07
## Penguin Group (USA) LLC-Amazon Digital Services,  Inc.   3272.03  0.00
## Simon and Schuster Digital Sales Inc-Hachette Book Group  -17.05  0.05
## Penguin Group (USA) LLC-Macmillan                        4070.48  0.07
#grabbing first row of tukey results
hachette_amazon_pair <- tukey_results[1, ]

ggplot(hachette_amazon_pair, aes(x = "", y = diff, fill = "Hachette - Amazon")) +
  geom_bar(stat = "identity", width = 0.5) +
  geom_errorbar(aes(ymin = lwr, ymax = upr), width = 0.2, color = "black") +
  scale_fill_manual(values = my_palette[1]) + 
  labs(x = "Hachette - Amazon", y = "Difference", fill = "") + 
  ggtitle("Mean Difference in Gross Sales Between Hachette and Amazon") +
  theme_minimal() +
  theme(axis.text.x = element_blank(),
        legend.position = "none")

The results of Tukey’s HSD was very telling in the differences in the mean average sales between publishers. The largest difference in mean average gross sales was between the Hachette Book Group and Amazon Digital Services Inc. The mean gross sales for books published by Hachette Book Group are estimated to be $2265.33 higher than those published by Amazon, with a 95% confidence interval ranging from $790.51 to $3740.16. The adjusted p-value also suggest that this is a significant difference.

Hachette was not the only publisher to seem to have an estimated higher mean of gross sales compared to Amazon. Penguin Group (USA) LLC, HarperCollins Publishers, and Random House LLC all had pretty significant differences in the mean of their gross sales compared to Amazon.

This was an incredibly insightful finding, because despite Amazon Digital Services Inc. being the most frequently used publisher, it does not appear to be generating a lot of sales revenue. This could be an insightful observation for authors who currently are not performing well by publishing through Amazon.

Publisher-Genre Analysis

Next, I wanted to see if certain genres perform better at certain publishers. Although this data set is very limited and genres, and a vast majority of the books in the data are fiction, we can examine the average book ratings on top of sales to see if there are genres that perform better depending on the publisher.

#average ratings and average sales for each genre at each publisher
publisher_genre_performance <- book_sales |>
  group_by(Publisher, genre) |>
  summarise(avg_ratings = mean(Book_average_rating),
            avg_sales = mean(`gross sales`))
## `summarise()` has grouped output by 'Publisher'. You can override using the
## `.groups` argument.
#average ratings by genre at each publisher
ggplot(publisher_genre_performance, aes(x = Publisher, y = avg_ratings, fill = genre)) +
  geom_bar(stat = "identity", position = "dodge") +
  labs(title = "Average Ratings by Genre at Each Publisher",
       x = "Publisher",
       y = "Average Ratings",
       fill = "Genre") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

The average ratings by genre at each publisher do not showcase very much variability. Children’s books seem to perform best at Macmillan, nonfiction appears to perform best at Penguin Group (USA) LLC, and fiction books appear to perform best at Simon and Schuster Digital Sales Inc.

#average sales by genre at each publisher
ggplot(publisher_genre_performance, aes(x = Publisher, y = avg_sales, fill = genre)) +
  geom_bar(stat = "identity", position = "dodge") +
  labs(title = "Average Sales by Genre at Each Publisher",
       x = "Publisher",
       y = "Average Sales",
       fill = "Genre") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

The average sales by genre for each publisher showcases a lot more variability than the average ratings. On average, children’s books generate most sales through Amazon Digital Services, Inc., nonfiction books generate most sales through Hachette Book Group, and fiction books generate most sales through HarperCollins Publishers.

Examining Book Ratings

Whilst exploring this data set, I was operating under the assumption that bestselling authors have higher book ratings, but it is important see if this assumption carries any weight.

top_authors <- book_sales[book_sales$Author %in% top_10_percent_authors$Author, ]
bottom_authors <- book_sales[book_sales$Author %in% bottom_10_percent_authors$Author, ]

ggplot() +
  geom_point(data = top_authors, aes(x = Book_ratings_count, y = Book_average_rating, color = "Top Authors"), alpha = 0.5) +
  geom_point(data = bottom_authors, aes(x = Book_ratings_count, y = Book_average_rating, color = "Bottom Authors"), alpha = 0.5) +
  geom_smooth(data = top_authors, aes(x = Book_ratings_count, y = Book_average_rating), method = "lm", formula = y ~ x, color = my_palette[2]) +
  geom_smooth(data = bottom_authors, aes(x = Book_ratings_count, y = Book_average_rating), method = "lm", formula = y ~ x, color = my_palette[1]) +
  labs(title = "Scatterplot of Ratings Count vs Average Ratings with Best Fit Lines",
       x = "Ratings Count",
       y = "Average Ratings",
       color = "Author Group") +
  scale_color_manual(name = "Author Group", values = c("Top Authors" = my_palette[2], "Bottom Authors" = my_palette[1])) +
  theme_minimal()

The scatter plot shows a lot of variability in the data between Ratings Count and Book Average Ratings for both the top 10% of authors and the bottom 10% of authors. However, the range the count of ratings is much greater for the top authors compared to the bottom authors.