Kasus 01 - Uji T Berpasangan - Efisiensi Energi Mesin Tempa

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

lama <- c(50, 55, 48, 60, 52, 58, 45, 53, 56, 59)
baru <- c(48, 50, 47, 55, 53, 54, 40, 52, 56, 56)
diff <- lama - baru
t.test(lama, baru, paired = TRUE, conf.level = 0.95)
## 
##  Paired t-test
## 
## data:  lama and baru
## t = 3.5553, df = 9, p-value = 0.006164
## alternative hypothesis: true mean difference is not equal to 0
## 95 percent confidence interval:
##  0.9093247 4.0906753
## sample estimates:
## mean difference 
##             2.5

Pada taraf nyata 5%, terdapat cukup bukti bahwa pelumas baru memberikan pengaruh signifikan terhadap konsumsi energi.

Kasus 02 - Uji T Dua Sampel Tidak Berpasangan - Panen Tomat

You can also embed plots, for example:

bio <- c(4.0, 5.5, 4.2, 5.3, 4.5, 5.0, 4.6, 5.1)
nutri <- c(5.2, 4.5, 5.5, 4.8, 5.0, 5.3, 4.6, 5.4, 4.7, 5.0)
t.test(bio, nutri, var.equal = FALSE, alternative = "less", conf.level = 0.90)
## 
##  Welch Two Sample t-test
## 
## data:  bio and nutri
## t = -1.031, df = 11.496, p-value = 0.1619
## alternative hypothesis: true difference in means is less than 0
## 90 percent confidence interval:
##        -Inf 0.07172719
## sample estimates:
## mean of x mean of y 
##     4.775     5.000

Tidak terdapat cukup bukti bahwa rata-rata hasil BioSubur lebih rendah dari NutriPrima.

Kasus 03 - Uji Satu Sampel – Kadar COD Limbah

# Diketahui:
x_bar <- 84       # rata-rata sampel
mu_0 <- 80        # rata-rata populasi
s <- 9            # simpangan baku sampel
n <- 9            # ukuran sampel

# Hitung t-statistik
t_stat <- (x_bar - mu_0) / (s / sqrt(n))
df <- n - 1
p_value <- 2 * pt(-abs(t_stat), df)

cat("t-statistik =", round(t_stat, 3), "\np-value =", round(p_value, 4), "\ndf =", df)
## t-statistik = 1.333 
## p-value = 0.2191 
## df = 8

Tidak cukup bukti bahwa kadar COD melebihi batas aman 80 mg/L.

Kasus 04 - Uji Chi-Square untuk Varians – Sikap Publik

data <- c(35, 40, 48, 55, 60, 65, 70, 75, 82, 88, 95, 100)
n <- length(data)
s2 <- var(data)
sigma2_0 <- 150

chi_sq <- (n - 1) * s2 / sigma2_0
p_value <- pchisq(chi_sq, df = n - 1, lower.tail = FALSE)

cat("Chi-square =", chi_sq, "p-value =", p_value)
## Chi-square = 32.775 p-value = 0.0005721869
# Uji dengan level signifikansi 10%

Terdapat cukup bukti bahwa varians sikap terhadap kebijakan AI meningkat.

Kasus 05 - Uji Satu Sampel – Kekuatan Tekan Beton

# Diketahui:
mu_sample <- 41.2
mu_0 <- 40
sigma <- 3
n <- 36
z <- (mu_sample - mu_0) / (sigma / sqrt(n))
p <- 2 * pnorm(-abs(z))

cat("Z =", z, "p-value =", p)
## Z = 2.4 p-value = 0.01639507

Terdapat cukup bukti bahwa aditif baru memengaruhi kekuatan tekan beton.

Kasus 06 - Uji Proporsi Satu Sampel – Hoaks

# H0: p = 0.35
# H1: p < 0.35
prop.test(x = 87, n = 300, p = 0.35, alternative = "less", conf.level = 0.90)
## 
##  1-sample proportions test with continuity correction
## 
## data:  87 out of 300, null probability 0.35
## X-squared = 4.4872, df = 1, p-value = 0.01707
## alternative hypothesis: true p is less than 0.35
## 90 percent confidence interval:
##  0.0000000 0.3263593
## sample estimates:
##    p 
## 0.29

Terdapat cukup bukti bahwa kampanye menurunkan proporsi penyebaran hoaks.

Kasus 07 - Uji Dua Rata-rata Populasi – Lini Alfa vs Beta (Varian Populasi Diketahui)

alfa <- c(75.01, 74.98, 75.03, 74.95, 75.00, 75.05, 74.97, 75.02, 74.99, 75.04)
beta <- c(75.05, 74.96, 75.08, 74.94, 75.02, 75.09, 74.95, 75.06, 74.97, 75.10, 75.03, 74.99)

mean1 <- mean(alfa)
mean2 <- mean(beta)
n1 <- length(alfa)
n2 <- length(beta)
sigma1_sq <- 0.0025
sigma2_sq <- 0.0036

z <- (mean1 - mean2) / sqrt(sigma1_sq/n1 + sigma2_sq/n2)
p <- 2 * pnorm(-abs(z))

cat("Z =", z, "p-value =", p)
## Z = -0.6822423 p-value = 0.4950858

Tidak terdapat cukup bukti bahwa diameter bearing berbeda antara dua lini.

Kasus 08 - Uji Proporsi Dua Sampel – Efek Samping Obat

# Obat Baru: 48/400
# Obat Lama: 45/500
prop.test(c(48, 45), c(400, 500), alternative = "greater", conf.level = 0.99)
## 
##  2-sample test for equality of proportions with continuity correction
## 
## data:  c(48, 45) out of c(400, 500)
## X-squared = 1.8469, df = 1, p-value = 0.08707
## alternative hypothesis: greater
## 99 percent confidence interval:
##  -0.02036661  1.00000000
## sample estimates:
## prop 1 prop 2 
##   0.12   0.09

Tidak terdapat cukup bukti bahwa Tenso понижена lebih buruk dari Normopress.

Kasus 09 - Uji Dua Sampel – Ketahanan Abrasi

inovatif <- c(2650, 2750, 2500, 2800, 2670, 2730, 2530, 2770, 2700)
klasik <- c(2600, 2700, 2450, 2730, 2530, 2670, 2550)

t.test(inovatif, klasik, var.equal = TRUE, alternative = "greater", conf.level = 0.99)
## 
##  Two Sample t-test
## 
## data:  inovatif and klasik
## t = 1.4197, df = 14, p-value = 0.08879
## alternative hypothesis: true difference in means is greater than 0
## 99 percent confidence interval:
##  -62.37094       Inf
## sample estimates:
## mean of x mean of y 
##  2677.778  2604.286

Tidak terdapat cukup bukti bahwa metode inovatif lebih tahan abrasi.

Kasus 10 - Uji Satu Sampel – Suhu Sudu Turbin

mu_sample <- 1091
mu_0 <- 1100
sigma <- 25
n <- 40
z <- (mu_sample - mu_0) / (sigma / sqrt(n))
p <- pnorm(z) # one-tailed

cat("Z =", z, "p-value =", p)
## Z = -2.27684 p-value = 0.01139789

Terdapat cukup bukti bahwa sistem pendinginan baru menurunkan suhu operasional.

Kasus 11 - Uji Perbandingan Varians – Diameter Piston Mesin

m1 <- c(74.97, 75.03, 74.95, 75.05, 75.00, 74.93, 75.07, 74.98, 75.02, 74.96, 75.04, 74.94, 75.06)
m2 <- c(74.98, 75.02, 75.00, 74.97, 75.03, 74.99, 75.01, 74.96, 75.04, 75.00)

var.test(m2, m1, alternative = "less", conf.level = 0.90)
## 
##  F test to compare two variances
## 
## data:  m2 and m1
## F = 0.28777, num df = 9, denom df = 12, p-value = 0.03479
## alternative hypothesis: true ratio of variances is less than 1
## 90 percent confidence interval:
##  0.0000000 0.6845712
## sample estimates:
## ratio of variances 
##          0.2877698

Terdapat cukup bukti bahwa Mesin M2 lebih konsisten.

Kasus 12 - ANOVA – Metode Pengajaran Desain

metode <- factor(c(rep("A",5), rep("B",6), rep("C",7), rep("D",6)))
skor <- c(75, 80, 72, 78, 70,
          82, 88, 85, 90, 80, 86,
          88, 92, 95, 85, 90, 87, 93,
          78, 82, 80, 75, 85, 77)

anova_model <- aov(skor ~ metode)
summary(anova_model)
##             Df Sum Sq Mean Sq F value  Pr(>F)    
## metode       3  764.6  254.88   18.31 5.9e-06 ***
## Residuals   20  278.3   13.92                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Terdapat cukup bukti bahwa metode pengajaran memberikan hasil yang berbeda secara signifikan.