2024-06-05

Data set and Libraries:

library(ggplot2)
library(dplyr)
library(plotly)
library(tidyverse)

Data:

df = read.csv("Top Youtubers Dataset.csv")
head(df)
##   Rank                   Youtuber Subscribers Video.Views Video.Count
## 1    1                    MrBeast   284000000 5.24029e+10         803
## 2    2                   T-Series   268000000 2.58624e+11       21237
## 3    3             YouTube Movies   181000000 0.00000e+00           0
## 4    4 Cocomelon - Nursery Rhymes   177000000 1.82881e+11        1188
## 5    5                  SET India   174000000 1.65395e+11      139720
## 6    6          ? Kids Diana Show   123000000 1.03973e+11        1230
##           Category Started
## 1    Entertainment    2012
## 2            Music    2006
## 3 Film & Animation    2015
## 4        Education    2006
## 5            Shows    2006
## 6   People & Blogs    2015

Simple Linear regression: {.smaller}

print("A simple linear regression measures the correlation between two variables.
      This is usually done by means of a scatter plot, where one can usually see the correlation.
      However, a regression line can be coded into the graph to provide more specific and 
      concrete evidence as to the sign of the correlation and its intensity.")
ggplot(df, aes(x = Subscribers, y = Video.Views)) + 
  geom_point() + 
  stat_smooth(method = "lm", formula = y~x, geom = "smooth") +
  labs(title = "Subscribers vs. Video_Views")

Simple Linear Regression: cont.

Linear Regression: cont.

Data Wrangling:

unique_cat = unique(df$Category)
print(unique_cat)
##  [1] "Entertainment"         "Music"                 "Film & Animation"     
##  [4] "Education"             "Shows"                 "People & Blogs"       
##  [7] ""                      "Gaming"                "Sports"               
## [10] "Howto & Style"         "News & Politics"       "Science & Technology" 
## [13] "Comedy"                "Trailers"              "Nonprofits & Activism"
## [16] "Movies"                "Pets & Animals"        "Autos & Vehicles"

Data Wranling: cont.

Data Wrangling: cont.

  • From this graph, we can determine the ranking of each category by number of youtubers that fall in them.
  • \(Entertainment > \mathbf{x} = \langle Music, People/Blogs, \dots\rangle\)$

Calculations:

  • \(avgsubcount = \frac{\sum_{x = 0}^{1000} f(X)}{numyoutubers} = 26624300\)
  • The number average number of subscribers for the top 1000 youtubers.