Advertising Spend and Sales

A linear regression analysis of how ad spend influences sales.
Author

Clayton Karnavas

Published

April 9, 2025

Keywords

advertising, data analytics, sales, linear regression, data visualization

Overview

This report explores how spending on TV, radio, and newspaper advertising correlates with sales performance.

The data comes from An Introduction to Statistical Learning, a textbook that covers data analysis using R and Python. The data set represents a fictional company’s ad spend and sales in 200 markets.

Importing Data, Running Packages

Code
library(tidyverse)
library(reactable)

ads <- read_csv("Advertising.csv")

ads <- ads |>
  rename(market = 1)

ads <- ads |>
  rename(tv = 2)

Ad Spend vs. Sales

To examine each channel’s effect on sales in more detail, I plotted sales against each advertising channel (TV, newspaper, and radio) with a linear trend line. All three channels’ ad spend displayed a positive, linear correlation with sales. However, the strength of the correlation varied among the three.

Code
ggplot(ads, aes(x = tv, y = sales)) +
  geom_point(color = "steelblue", alpha = 0.7) +
  geom_smooth(method = "lm", se = FALSE, color = "darkred") +
  labs(x = "TV Ad Spend", y = "Sales", 
       title = "TV Advertising Spend vs. Sales") +
  theme_minimal()

Code
ggplot(ads, aes(x = radio, y = sales)) +
  geom_point(color = "steelblue", alpha = 0.7) +
  geom_smooth(method = "lm", se = FALSE, color = "darkred") +
  labs(x = "Radio Ad Spend", y = "Sales", 
       title = "Radio Ad Spend vs. Sales") +
  theme_minimal()

Code
ggplot(ads, aes(x = newspaper, y = sales)) +
  geom_point(color = "steelblue", alpha = 0.7) +
  geom_smooth(method = "lm", se = FALSE, color = "darkred") +
  labs(x = "Newspaper Ad Spend", y = "Sales", 
       title = "Newspaper Ad Spend vs. Sales") +
  theme_minimal()

Linear Relationship Analysis

To assess the individual strength of each advertising channel’s relationship with product sales, I ran separate linear regressions for TV, radio, and newspaper spend. The table below summarizes the R² values and corresponding correlation strength:

Code
channels <- c("tv", "radio", "newspaper")

r2_table <- function(channel) {
  formula <- reformulate(channel, response = "sales")
  model <- lm(formula, data = ads)
  r2 <- summary(model)$r.squared
  
  strength <- case_when(
    r2 < 0.2 ~ "Very Weak",
    r2 < 0.4 ~ "Weak",
    r2 < 0.6 ~ "Moderate",
    r2 < 0.8 ~ "Strong",
    TRUE ~ "Very Strong"
  )
  
  tibble(
    Channel = str_to_title(channel),
    R_Squared = round(r2, 3),
    Correlation_Strength = strength
  )
}

map_dfr(channels, r2_table) |>
  reactable(
    bordered = TRUE,
    highlight = TRUE,
    defaultSorted = "R_Squared",
    defaultSortOrder = "desc",
    columns = list(
      R_Squared = colDef(name = "R² Value", format = colFormat(digits = 3)),
      Correlation_Strength = colDef(name = "Strength")
    ),
    theme = reactableTheme(
      stripedColor = "#f6f8fa",
      highlightColor = "#e3f2fd"
    )
  )

 

The TV advertising channel stands out as the most impactful, with an R² value of 0.612, indicating that over 61% of the variance in sales can be explained by TV ad spend alone. This reflects a strong linear relationship and suggests that investment in TV advertising is closely tied to increased sales performance.

Radio, while still positively associated with sales, shows a weaker relationship, with an R² of 0.332. This suggests that radio spend accounts for roughly a third of the variation in sales on its own, pointing to a less consistent and more variable influence compared to TV.

Newspaper advertising, with an R² value of just 0.052, shows a very weak correlation with sales. This minimal explanatory power indicates that newspaper ad spend contributes little to sales variation in this dataset and may not be a useful standalone predictor.

Conclusion

These findings highlight the importance of allocating marketing budgets strategically. For this fictional company, investment in TV and radio appears to have a measurable impact on sales, while newspaper advertising may offer limited return. While this dataset is limited in scope, it provides a clear, data-driven foundation for making more informed advertising decisions.