Global Baseline Estimate

Author

Ozge Gundogan

Published

September 20, 2026

Introduction

This project will use rating data collected from five users for the first six episodes of the television series “Gibi”. The goal is to build a Global Baseline Estimate recommendation system that can estimate missing ratings and use these estimates to make recommendations.

Planned Approach

I plan to first examine the rating data and identify the ratings that are missing. I will calculate the overall average rating, the average rating for each user, and the average rating for each episode. I will then use these values to calculate user and episode biases and apply the Global Baseline Estimate formula to predict the missing ratings. Finally, I will compare the predicted ratings and recommend the episode with the highest estimated rating for each user.

Anticipated Data Challenges

One anticipated challenge is handling missing ratings correctly because they represent episodes that a user did not rate and should not be included when calculating averages. Another challenge is making sure that each user bias and episode bias is matched with the correct missing rating when calculating the predictions. I will also need to make sure that the data can be accessed from an online source so that the analysis is reproducible.

Code Base

Load R Packages

This section loads the R packages required for data manipulation and analysis.

library(dplyr)

Attaching package: 'dplyr'
The following objects are masked from 'package:stats':

    filter, lag
The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union

Load Data

This section loads the rating data collected in the previous assignment. Missing ratings are treated as “NA” values because they represent episodes that a user did not rate.

gibi_ratings <- read.csv(
  "https://raw.githubusercontent.com/OzgeG01/DATA607-Assignment/refs/heads/main/gibi_ratings.csv",
  na.strings = c("", "NA")
)

gibi_ratings
     name episode_number         title rating
1   Deniz              1       Kokaric      5
2   Koray              1       Kokaric      5
3    Okan              1       Kokaric      5
4   Pelin              1       Kokaric      4
5  Serpil              1       Kokaric      5
6   Deniz              2         Vatka      4
7   Koray              2         Vatka      5
8    Okan              2         Vatka      4
9   Pelin              2         Vatka      5
10 Serpil              2         Vatka      4
11  Deniz              3      Nu Model     NA
12  Koray              3      Nu Model      4
13   Okan              3      Nu Model     NA
14  Pelin              3      Nu Model      4
15 Serpil              3      Nu Model      4
16  Deniz              4  Erasmusla GY      5
17  Koray              4  Erasmusla GY      5
18   Okan              4  Erasmusla GY      5
19  Pelin              4  Erasmusla GY      5
20 Serpil              4  Erasmusla GY      5
21  Deniz              5 Yanlis Mentor     NA
22  Koray              5 Yanlis Mentor      3
23   Okan              5 Yanlis Mentor      3
24  Pelin              5 Yanlis Mentor      3
25 Serpil              5 Yanlis Mentor     NA
26  Deniz              6  Karanlik Guc      4
27  Koray              6  Karanlik Guc      5
28   Okan              6  Karanlik Guc      5
29  Pelin              6  Karanlik Guc      5
30 Serpil              6  Karanlik Guc      5

Global Mean

This section calculates the global mean of all available ratings. Missing ratings are excluded from the calculation. The global mean represents the overall average rating across all users and episodes.

global_mean <- mean(gibi_ratings$rating, na.rm = TRUE)

global_mean
[1] 4.461538

User Bias

This section calculates the average rating for each user and their user bias. The user bias measures how much a user’s average rating differs from the global mean.

user_bias <- gibi_ratings %>%
  group_by(name) %>%
  summarise(
    user_mean = mean(rating, na.rm = TRUE),
    .groups = "drop"
  ) %>%
  mutate(
    user_bias = user_mean - global_mean
  )

user_bias
# A tibble: 5 × 3
  name   user_mean user_bias
  <chr>      <dbl>     <dbl>
1 Deniz       4.5     0.0385
2 Koray       4.5     0.0385
3 Okan        4.4    -0.0615
4 Pelin       4.33   -0.128 
5 Serpil      4.6     0.138 

Episode Bias

This section calculates the average rating for each episode and its episode bias. The episode bias measures how much an episode’s average rating differs from the global mean.

episode_bias <- gibi_ratings %>%
  group_by(episode_number, title) %>%
  summarise(
    episode_mean = mean(rating, na.rm = TRUE),
    .groups = "drop"
  ) %>%
  mutate(
    episode_bias = episode_mean - global_mean
  )

episode_bias
# A tibble: 6 × 4
  episode_number title         episode_mean episode_bias
           <int> <chr>                <dbl>        <dbl>
1              1 Kokaric                4.8       0.338 
2              2 Vatka                  4.4      -0.0615
3              3 Nu Model               4        -0.462 
4              4 Erasmusla GY           5         0.538 
5              5 Yanlis Mentor          3        -1.46  
6              6 Karanlik Guc           4.8       0.338 

Missing Ratings

This section identifies the user and episode combinations with missing ratings. These missing values represent episodes that a user did not rate and will be estimated using the Global Baseline Estimate algorithm.

missing_ratings <- gibi_ratings %>%
  filter(is.na(rating))

missing_ratings
    name episode_number         title rating
1  Deniz              3      Nu Model     NA
2   Okan              3      Nu Model     NA
3  Deniz              5 Yanlis Mentor     NA
4 Serpil              5 Yanlis Mentor     NA

Add User and Episode Biases

This section combines the missing ratings with the corresponding user and episode bias values. These bias values will be used to calculate the Global Baseline Estimate for each missing rating.

missing_ratings_with_bias <- missing_ratings %>%
  left_join(user_bias, by = "name") %>%
  left_join(
    episode_bias,
    by = c("episode_number", "title")
  )

missing_ratings_with_bias
    name episode_number         title rating user_mean   user_bias episode_mean
1  Deniz              3      Nu Model     NA       4.5  0.03846154            4
2   Okan              3      Nu Model     NA       4.4 -0.06153846            4
3  Deniz              5 Yanlis Mentor     NA       4.5  0.03846154            3
4 Serpil              5 Yanlis Mentor     NA       4.6  0.13846154            3
  episode_bias
1   -0.4615385
2   -0.4615385
3   -1.4615385
4   -1.4615385

Global Baseline Estimates

This section calculates the Global Baseline Estimate for each missing rating. The estimate is calculated by adding the global mean, the user’s bias, and the episode’s bias.

baseline_estimates <- missing_ratings_with_bias %>%
  mutate(
    predicted_rating = global_mean + user_bias + episode_bias
  )

baseline_estimates
    name episode_number         title rating user_mean   user_bias episode_mean
1  Deniz              3      Nu Model     NA       4.5  0.03846154            4
2   Okan              3      Nu Model     NA       4.4 -0.06153846            4
3  Deniz              5 Yanlis Mentor     NA       4.5  0.03846154            3
4 Serpil              5 Yanlis Mentor     NA       4.6  0.13846154            3
  episode_bias predicted_rating
1   -0.4615385         4.038462
2   -0.4615385         3.938462
3   -1.4615385         3.038462
4   -1.4615385         3.138462

Recommendation

This section selects the episode with the highest predicted rating for each user. The episode with the highest Global Baseline Estimate among the user’s missing ratings is recommended to that user.

recommendations <- baseline_estimates %>%
  group_by(name) %>%
  slice_max(
    order_by = predicted_rating,
    n = 1,
    with_ties = FALSE
  ) %>%
  ungroup() %>%
  select(name, episode_number, title, predicted_rating)

recommendations
# A tibble: 3 × 4
  name   episode_number title         predicted_rating
  <chr>           <int> <chr>                    <dbl>
1 Deniz               3 Nu Model                  4.04
2 Okan                3 Nu Model                  3.94
3 Serpil              5 Yanlis Mentor             3.14

Conclusion

The Global Baseline Estimate algorithm was used to predict the four missing ratings in the dataset. The predicted ratings were 4.04 for Deniz on “Nu Model”, 3.94 for Okan on “Nu Model”, 3.04 for Deniz on “Yanlis Mentor”, and 3.14 for Serpil on “Yanlis Mentor”. These estimates reflect both each user’s general rating behavior and each episode’s overall rating relative to the global mean.

Based on the predicted ratings, “Nu Model” was recommended to Deniz and Okan, while “Yanlis Mentor” was recommended to Serpil. For users with more than one missing rating, the episode with the highest predicted rating was selected as the recommendation.

Citation

I used ChatGPT (GPT-5.6 Luna), developed by OpenAI, to help me understand some of the functions I used in this assignment and to check my work.

OpenAI. (2026). ChatGPT (GPT-5.6 Luna) [Large language model]. [https://chatgpt.com/ Accessed September 20, 2026].

Video Explainer

Link: