The Question

If a video game sells well in North America, how well will it sell worldwide?

  • Game studios and publishers must decide where to invest marketing money.
  • North America is the largest market for most games in this dataset.
  • Can early NA numbers give a reliable forecast of global sales?


Statistical idea: Simple linear regression and correlation, with a confidence interval and a hypothesis test.

The Data

First five rows (millions of copies)
Name Genre NA_Sales EU_Sales Global_Sales
Wii Sports Sports 41.49 29.02 82.74
Super Mario Bros. Platform 29.08 3.58 40.24
Mario Kart Wii Racing 15.85 12.88 35.82
Wii Sports Resort Sports 15.75 11.01 33.00
Pokemon Red/Pokemon Blue Role-Playing 11.27 8.89 31.37

Scatterplot

Interpretation: The pattern is strongly upward, but a few blockbusters (like Wii Sports) stretch the axes and most games are crowded near zero.

Regression Line Variable Definitions

Symbol Meaning in our video game example
\(n\) Number of games in the data set
\(i\) Index of one game, \(i = 1, 2, \dots, n\)
\(x_i\) North American sales of game \(i\) (millions of copies), the predictor
\(y_i\) Global sales of game \(i\) (millions of copies), the response
\(\bar x,\ \bar y\) Sample means of NA sales and of global sales
\(\beta_0,\ \beta_1\) True (unknown) population intercept and slope
\(\varepsilon_i\) Random error for game \(i\): what NA sales cannot explain
\(\sigma^2\) Variance of the errors (how much games scatter around the line)
\(N(0,\sigma^2)\) Normal distribution with mean 0 and variance \(\sigma^2\)
\(b_0,\ b_1\) Estimates of \(\beta_0,\beta_1\) computed from our sample
\(\hat y\) Predicted global sales, \(\hat y = b_0 + b_1 x\)

The Regression Line

Model for game \(i\):

\[y_i = \beta_0 + \beta_1 x_i + \varepsilon_i, \qquad \varepsilon_i \sim N(0,\sigma^2)\]

Least squares chooses \(b_0, b_1\) to minimize the sum of squared residuals:

\[\min_{b_0,b_1} \sum_{i=1}^{n} \left(y_i - b_0 - b_1 x_i\right)^2\]

with solution

\[b_1 = \frac{\sum_{i}(x_i-\bar x)(y_i-\bar y)}{\sum_{i}(x_i-\bar x)^2}, \qquad b_0 = \bar y - b_1 \bar x\]

Meaning: \(b_1\) is the predicted change in global sales (millions) for each extra million sold in North America.

Correlation and Inference Variable Definitions

Symbol Meaning
\(r\) Sample correlation between \(x\) and \(y\) (−1 to 1)
\(R^2\) Share of variation in global sales explained by NA sales
\(H_0\) Null hypothesis: \(\beta_1 = 0\) (no linear relationship)
\(H_a\) Alternative hypothesis: \(\beta_1 \neq 0\)
\(SE(b_1)\) Standard error of the slope estimate
\(t\) Test statistic: how many standard errors \(b_1\) is from 0
\(t_{n-2}\) \(t\) distribution with \(n-2\) degrees of freedom
\(t^{*}_{n-2}\) Critical value for 95% confidence (about 1.96 for large \(n\))

Correlation and Inference

Correlation measures the strength of the linear relationship:

\[r = \frac{\sum_{i}(x_i-\bar x)(y_i-\bar y)}{\sqrt{\sum_{i}(x_i-\bar x)^2\,\sum_{i}(y_i-\bar y)^2}} \qquad R^2 = r^2\]

Hypothesis test for the slope:

\[H_0:\ \beta_1 = 0 \quad \text{vs.} \quad H_a:\ \beta_1 \neq 0, \qquad t = \frac{b_1 - 0}{SE(b_1)} \sim t_{n-2}\]

95% confidence interval for the slope:

\[b_1 \ \pm\ t^{*}_{n-2}\, SE(b_1)\]

R Code

# Read and clean the data
vg <- read_csv("vgsales.csv", na = c("", "NA", "N/A"))
vg_na <- vg %>% filter(NA_Sales > 0)

# Fit the simple linear regression
fit <- lm(Global_Sales ~ NA_Sales, data = vg_na)

summary(fit)$coefficients   # estimates, SE, t, p-value
##               Estimate  Std. Error    t value     Pr(>|t|)
## (Intercept) 0.03172333 0.005787590   5.481268 4.307538e-08
## NA_Sales    1.80313216 0.005755948 313.264171 0.000000e+00
confint(fit, level = 0.95)  # 95% CI for b0 and b1
##                  2.5 %     97.5 %
## (Intercept) 0.02037873 0.04306794
## NA_Sales    1.79184958 1.81441473
cor(vg_na$NA_Sales, vg_na$Global_Sales)   # correlation r
## [1] 0.9435349

What the Model Says

Term Estimate Std. Error t value Pr(>|t|) Lower95 Upper95
(Intercept) 0.03172 0.005788 5.481 0 0.02038 0.04307
NA_Sales 1.80300 0.005756 313.300 0 1.79200 1.81400
  • Slope \(b_1 =\) 1.803
    • each extra 1 million NA copies is associated with about 1.8 million more copies worldwide.
  • 95% CI: (1.792, 1.814)
    • so the slope is estimated precisely.
  • Correlation \(r =\) 0.944 and \(R^2 =\) 0.89
    • NA sales explain about 89% of the variation in global sales.
  • Test: \(t =\) 313.3 and p-value < 2.2e-16 → strong evidence to reject \(H_0:\beta_1=0\).

ggplot2: Fitted Line with Confidence Band

Interpretation: The shaded band is the uncertainty in the average global sales at each NA value. It is narrow, so the trend is very reliable.

ggplot2: Checking the Model

Interpretation: The residuals fan out as sales grow (non-constant variance) and a few blockbusters are large positive outliers. The slope is trustworthy as a trend, but individual predictions for hits are far less certain than the band suggests.

Interactive Plotly: Sales in 3D

Games with at least 0.5M global sales. Global sales rise with both NA and EU sales, which hints that a multiple regression using both would predict even better.

What Did We Learn?

  • Strong, positive linear relationship between NA sales and Global sales
    • (\(r \approx\) 0.94, \(R^2 \approx\) 0.89.)
  • Each extra million NA copies goes with about 1.8 million more copies globally
    • 95% CI: 1.79 to 1.81
  • The slope is statistically significant
    • p-value is essentially 0
  • Possibly looking at the both NA sales and EU sales will be a more accurate predictor of Global sales.