ecotrack <- c(22, 25, 19, 30, 24, 21, 45, 23, 20, 26, 24, 22, 18, 27, 23)
# Mean & Median
mean(ecotrack) # Output: 24.6
## [1] 24.6
median(ecotrack) # Output: 23
## [1] 23
# Modus
get_mode <- function(v) {
uniqv <- unique(v)
freq <- tabulate(match(v, uniqv))
uniqv[freq == max(freq)]
}
get_mode(ecotrack) # Output: 22 23 24
## [1] 22 24 23
q1 <- quantile(ecotrack, 0.25, type = 6)
q3 <- quantile(ecotrack, 0.75, type = 6)
iqr_val <- IQR(ecotrack, type = 6)
cat("Q1:", q1, "| Q3:", q3, "| IQR:", iqr_val, "\n")[]
## Q1: 21 | Q3: 26 | IQR: 5
## NULL
var(ecotrack) # Output: 41.54286
## [1] 41.54286
sd(ecotrack) # Output: 6.445375
## [1] 6.445375
library(e1071)
skewness(ecotrack) # Output: 2.212573 (Skewness berbasis momen)
## [1] 1.995046
# Verifikasi Pearson Manual di R
3 * (mean(ecotrack) - median(ecotrack)) / sd(ecotrack) # Output: 0.7447201
## [1] 0.7447201