Persiapan data
data_anime <- read.csv("anime_clean.csv")
data_anime <- na.omit(data_anime)
data_tv <- subset(data_anime, type == "TV" & grepl("Action", genre))
data_uji <- subset(data_anime, type %in% c("TV", "Movie") & grepl("Action", genre))
data_uji$type <- as.factor(data_uji$type)
head(data_anime)
## anime_id name
## 1 32281 Kimi no Na wa.
## 2 5114 Fullmetal Alchemist: Brotherhood
## 3 28977 Gintama°
## 4 9253 Steins;Gate
## 5 9969 Gintama'
## 6 32935 Haikyuu!!: Karasuno Koukou VS Shiratorizawa Gakuen Koukou
## genre type episodes
## 1 Drama, Romance, School, Supernatural Movie 1
## 2 Action, Adventure, Drama, Fantasy, Magic, Military, Shounen TV 64
## 3 Action, Comedy, Historical, Parody, Samurai, Sci-Fi, Shounen TV 51
## 4 Sci-Fi, Thriller TV 24
## 5 Action, Comedy, Historical, Parody, Samurai, Sci-Fi, Shounen TV 51
## 6 Comedy, Drama, School, Shounen, Sports TV 10
## rating members log_members
## 1 9.37 200630 12.20922
## 2 9.26 793665 13.58442
## 3 9.25 114262 11.64625
## 4 9.17 673572 13.42035
## 5 9.16 151266 11.92680
## 6 9.15 93351 11.44412
anime_filtered <- subset(data_anime, type == "TV" & grepl("Action", genre))
head(anime_filtered)
## anime_id name
## 2 5114 Fullmetal Alchemist: Brotherhood
## 3 28977 Gintama°
## 5 9969 Gintama'
## 7 11061 Hunter x Hunter (2011)
## 9 15417 Gintama': Enchousen
## 12 918 Gintama
## genre type episodes
## 2 Action, Adventure, Drama, Fantasy, Magic, Military, Shounen TV 64
## 3 Action, Comedy, Historical, Parody, Samurai, Sci-Fi, Shounen TV 51
## 5 Action, Comedy, Historical, Parody, Samurai, Sci-Fi, Shounen TV 51
## 7 Action, Adventure, Shounen, Super Power TV 148
## 9 Action, Comedy, Historical, Parody, Samurai, Sci-Fi, Shounen TV 13
## 12 Action, Comedy, Historical, Parody, Samurai, Sci-Fi, Shounen TV 201
## rating members log_members
## 2 9.26 793665 13.58442
## 3 9.25 114262 11.64625
## 5 9.16 151266 11.92680
## 7 9.13 425855 12.96185
## 9 9.11 81109 11.30355
## 12 9.04 336376 12.72598
Analisis Deskriptif
Rata rata rating
rata_rating_tv <- mean(data_tv$rating)
print(rata_rating_tv)
## [1] 7.111293
Hubungan log member vs rating
plot(data_tv$log_members, data_tv$rating,
main = "Hubungan Log Members vs Rating (Anime Action TV)",
xlab = "Logarithm of Members (Popularitas)",
ylab = "Rating",
pch = 19,
col = "steelblue")
abline(lm(rating ~ log_members, data = data_tv), col = "red", lwd = 2)

Distribusi nilai rating
hist(data_tv$rating,
breaks = 20,
main = "Distribusi Nilai Rating Anime Action (TV)",
xlab = "Rating",
col = "darkseagreen",
border = "white")

Uji Asumsi Multivariat dan MANOVA
par(mfrow = c(1, 2))
# Plot Distribusi Rating
boxplot(rating ~ type, data = data_uji,
main = "Distribusi Rating (Movie vs TV)",
ylab = "Rating", xlab = "Format Tayangan",
col = c("lightcoral", "lightblue"))
# Plot Distribusi Popularitas
boxplot(log_members ~ type, data = data_uji,
main = "Distribusi Popularitas (Log Members)",
ylab = "Log Members", xlab = "Format Tayangan",
col = c("lightgreen", "khaki"))

par(mfrow = c(1, 1))
Uji Normalitas Multivariat (Mardia’s Test)
library(MVN)
data_mvn <- data_uji[, c("rating", "log_members")]
hasil_mardia <- MVN::mvn(data_mvn)
print(hasil_mardia$multivariateNormality)
## NULL
Uji Homogenitas Matrixs kovarian
library(heplots)
hasil_boxm <- boxM(cbind(rating, log_members) ~ type, data = data_uji)
print(hasil_boxm)
##
## Box's M-test for Homogeneity of Covariance Matrices
##
## data: data_uji
## Chi-Sq (approx.) = 360.5003, df = 3, p-value = < 2.2e-16
Model MANOVA Dasar
model_manova <- manova(cbind(rating, log_members) ~ type, data = data_uji)
#hasil dengan Pillai's Trace
summary(model_manova, test = "Pillai")
## Df Pillai approx F num Df den Df Pr(>F)
## type 1 0.083589 72.743 2 1595 < 2.2e-16 ***
## Residuals 1596
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Pemodelan Mancova
model_mancova <- manova(cbind(rating, log_members) ~ episodes + type, data = data_uji)
summary(model_mancova, test = "Pillai")
## Df Pillai approx F num Df den Df Pr(>F)
## episodes 1 0.039315 32.616 2 1594 1.31e-14 ***
## type 1 0.083245 72.371 2 1594 < 2.2e-16 ***
## Residuals 1595
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Uji Effect Size
library(effectsize)
eta_squared(model_mancova, partial = TRUE)
## # Effect Size for ANOVA (Type I)
##
## Parameter | Eta2 (partial) | 95% CI
## -----------------------------------------
## episodes | 0.04 | [0.02, 1.00]
## type | 0.08 | [0.06, 1.00]
##
## - One-sided CIs: upper bound fixed at [1.00].
Ancova Parsial
summary.aov(model_mancova)
## Response rating :
## Df Sum Sq Mean Sq F value Pr(>F)
## episodes 1 47.00 46.998 54.010 3.172e-13 ***
## type 1 48.51 48.513 55.751 1.347e-13 ***
## Residuals 1595 1387.94 0.870
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Response log_members :
## Df Sum Sq Mean Sq F value Pr(>F)
## episodes 1 38.6 38.63 7.1057 0.007762 **
## type 1 780.3 780.31 143.5196 < 2.2e-16 ***
## Residuals 1595 8672.0 5.44
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Uji lanjut (Estimate Marginal Means)
library(emmeans)
model_rating <- aov(rating ~ episodes + type, data = data_uji)
model_members <- aov(log_members ~ episodes + type, data = data_uji)
# Rata-rata estimasi Rating
emmeans(model_rating, ~ type)
## type emmean SE df lower.CL upper.CL
## Movie 6.66 0.0438 1595 6.58 6.75
## TV 7.09 0.0302 1595 7.03 7.14
##
## Confidence level used: 0.95
# Rata-rata estimasi Log Members
emmeans(model_members, ~ type)
## type emmean SE df lower.CL upper.CL
## Movie 7.79 0.1090 1595 7.57 8.00
## TV 9.47 0.0756 1595 9.33 9.62
##
## Confidence level used: 0.95