Setup & Load Data

library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.5.3
## Warning: package 'readr' was built under R version 4.5.3
## Warning: package 'forcats' was built under R version 4.5.3
## Warning: package 'lubridate' was built under R version 4.5.3
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.2.0     ✔ readr     2.2.0
## ✔ forcats   1.0.1     ✔ stringr   1.6.0
## ✔ ggplot2   4.0.2     ✔ tibble    3.3.1
## ✔ lubridate 1.9.5     ✔ tidyr     1.3.2
## ✔ purrr     1.2.1     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(GGally)
## Warning: package 'GGally' was built under R version 4.5.3
anime <- read.csv("anime_clean.csv")

anime$type <- as.factor(anime$type)

head(anime)

Statistika Deskriptif

# Menghitung rata-rata untuk masing-masing grup (TV vs Movie)
ringkasan_data <- anime %>%
  group_by(type) %>%
  summarise(
    Rata_Rating = mean(rating),
    Rata_Log_Members = mean(log_members),
    Rata_Episode = mean(episodes),
    Total_Anime = n()
  )

print(ringkasan_data)
## # A tibble: 2 × 5
##   type  Rata_Rating Rata_Log_Members Rata_Episode Total_Anime
##   <fct>       <dbl>            <dbl>        <dbl>       <int>
## 1 Movie        6.32             6.71         1.10        2296
## 2 TV           6.93             8.54        36.0         3570

Membuat Correlogram

# Memilih hanya kolom-kolom yang relevan untuk di-plot
data_visual <- anime %>% 
  select(type, episodes, rating, log_members)

# Membuat Correlogram dengan membedakan warna berdasarkan 'type' (TV/Movie)
plot_korelasi <- ggpairs(
  data_visual,
  mapping = aes(color = type, alpha = 0.5),
  title = "Correlogram: Episode, Rating, dan Popularitas (Log Members)",
  lower = list(continuous = wrap("points", size = 0.5)) # Biar titiknya nggak terlalu besar
)

# Menampilkan plot ke layar
print(plot_korelasi)
## `stat_bin()` using `bins = 30`. Pick better value `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value `binwidth`.

Uji Asumsi Homogenitas Kemiringan Regresi

asumsi_kemiringan <- manova(cbind(rating, log_members) ~ type * episodes, data = anime)

summary(asumsi_kemiringan)
##                 Df   Pillai approx F num Df den Df  Pr(>F)    
## type             1 0.124168   415.46      2   5861 < 2e-16 ***
## episodes         1 0.022888    68.65      2   5861 < 2e-16 ***
## type:episodes    1 0.000851     2.50      2   5861 0.08257 .  
## Residuals     5862                                            
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Uji Homogenitas Matriks Kovarians (Box’s M Test)

library(heplots)
## Warning: package 'heplots' was built under R version 4.5.3
## Loading required package: broom
## Warning: package 'broom' was built under R version 4.5.3
asumsi_boxM <- boxM(cbind(rating, log_members) ~ type, data = anime)
print(asumsi_boxM)
## 
##  Box's M-test for Homogeneity of Covariance Matrices 
## 
## data:  anime 
## Chi-Sq (approx.) = 718.4303, df = 3, p-value = < 2.2e-16

Uji Normalitas Multivariat (Mardia’s Test)

library(psych)
## Warning: package 'psych' was built under R version 4.5.3
## 
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
## 
##     %+%, alpha
data_dependen <- anime %>% select(rating, log_members)

uji_mardia_psych <- mardia(data_dependen)

print(uji_mardia_psych)
## Call: mardia(x = data_dependen)
## 
## Mardia tests of multivariate skew and kurtosis
## Use describe(x) the to get univariate tests
## n.obs = 5866   num.vars =  2 
## b1p =  0.99   skew =  964.23  with probability  <=  2e-207
##  small sample skew =  965.06  with probability <=  1.3e-207
## b2p =  9.21   kurtosis =  11.57  with probability <=  0

Menjalankan Model MANCOVA

model_mancova <- manova(cbind(rating, log_members) ~ episodes + type, data = anime)

hasil_mancova <- summary(model_mancova, test = "Pillai")
print(hasil_mancova)
##             Df   Pillai approx F num Df den Df    Pr(>F)    
## episodes     1 0.011242    33.32      2   5862 4.065e-15 ***
## type         1 0.133297   450.78      2   5862 < 2.2e-16 ***
## Residuals 5863                                              
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Menghitung Effect Size (Partial Eta Squared)

library(effectsize)
## Warning: package 'effectsize' was built under R version 4.5.3
## 
## Attaching package: 'effectsize'
## The following object is masked from 'package:psych':
## 
##     phi
eta_mancova <- eta_squared(model_mancova, partial = TRUE)

# Menampilkan hasil
print(eta_mancova)
## # Effect Size for ANOVA (Type I)
## 
## Parameter | Eta2 (partial) |       95% CI
## -----------------------------------------
## episodes  |           0.01 | [0.01, 1.00]
## type      |           0.13 | [0.12, 1.00]
## 
## - One-sided CIs: upper bound fixed at [1.00].