2025-09-21

Hypothesis Testing (Definition)

Hypothesis testing is used to determine if observed data provides sufficient evidence to reject a default assumption (H₀).

\[ H_0: \beta = 0 \\ H_1: \beta \neq 0 \]

  • Purpose: Test whether critic score significantly affects total sales.
  • Significance level : (\(\alpha = 0.05\))
  • Decision rule: Reject \(H_0\) if p-value \(\leq \alpha\), otherwise fail to reject \(H_0\).
  • Interpretation: \(H_0\) = no effect, \(H_1\) = effect exists

Hypothesis testing (interpretation)

For our model we will set the following hypothesis and levels:

Hypothesis/Levels Meaning
\[H_0: \beta = 0\] No effect of critic_score on sales
\[H_1: \beta \neq 0\] Critic_score affects sales
\[\alpha\] Significance value 0.05

Visualizing the data with Scatter plot

Scatterplot code for previous figure

games_filtered <- games %>%
  filter(!is.na(critic_score), !is.na(total_sales), !is.na(genre)) 

genre_counts <- games_filtered %>% count(genre)

games_filtered <- games_filtered %>%
  mutate(genre_grouped = ifelse(
    genre %in% genre_counts$genre[1:8],  
    genre,
    "Other"))

fig <- plot_ly(games_filtered,
               x = ~critic_score, y = ~total_sales,
               type = "scatter",
               mode = "markers",
               color = ~genre_grouped, colors = "Set1",
               marker = list(size = 3, opacity = 0.5))

fig <- fig %>%
  layout(title = "Critic Score vs Total Sales",
         xaxis = list(title = "Critic Score (1-10"), 
         yaxis = list(title = "Total Sales(Millions of copies)"),
         width = 600, height = 400,
         legend = list(title = list(text = "Genre"))
         )
fig

Determining model data

model <- lm(total_sales ~ critic_score, data = games_filtered)
summary(model)
## 
## Call:
## lm(formula = total_sales ~ critic_score, data = games_filtered)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.4421 -0.6193 -0.3069  0.1583 18.9505 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -1.21683    0.10597  -11.48   <2e-16 ***
## critic_score  0.27515    0.01462   18.82   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.352 on 4124 degrees of freedom
## Multiple R-squared:  0.07905,    Adjusted R-squared:  0.07883 
## F-statistic:   354 on 1 and 4124 DF,  p-value: < 2.2e-16

Interpreting model data

Variable Meaning
Intercept: -1.21683 When critic_scores are 0,
total_sales = -1.21683 Million copies sold. No real practical value
slope: 0.27515 For every 1 increase in critic_scores,
total_sales increases by 0.27515
p-value: <2×10−16 Predicts significance of impact
of critic_score against total_sales.
Smaller t-values imply more significance.
r-squared: 0.079 The predictor is significant, but only explains ~7.9%

Model Formula: \[\hat{y} (\text {Millions of copies Sold}) = -1.21683 + 0.27515 \times (\text{critic_score})\]

ggplot2 with trendline

## `geom_smooth()` using formula = 'y ~ x'

ggplot2 of total_sales by genre

Critic Score and Total Sales: Key Findings

Hypothesis Testing

  • Null Hypothesis (\(H_0\)): Critic score has no effect on total sales (\(\beta = 0\))
  • Alternative Hypothesis (\(H_1\)): Critic score affects total sales (\(\beta \neq 0\))
  • Significance Level: \(\alpha = 0.05\)

Regression Results

\[ \text{Model: } \hat{y} = \beta_0 + \beta_1 \cdot \text{critic_score} \quad \Rightarrow \quad \text{Estimated: } \hat{y} = -1.217 + 0.275 \cdot \text{critic_score} \]

  • Coefficient (\(\beta_1\)): \(0.275\), \(t = 18.82\), \(p < 2 \times 10^{-16}\)
  • \(R^2\): \(0.079\) → Critic score explains approximately \(7.9\%\) of the variation in total sales

Interpretation

  • Evidence: Reject \(H_0\); critic score significantly affects total sales.
  • Magnitude: Each 1-point increase in critic score increases sales by approximately \(0.275\) million copies on average.
  • Limitations: Low \(R^2\) indicates that other factors (e.g., genre, platform, etc) influence total sales.

Conclusion

  • Critic scores matter statistically, but they are not the sole driver of total sales.