Professional Documents
Culture Documents
NIM : 22/493959/PA/21232
x=c(3.2,6.2,6.2)
y=c(6.2,6.2,3.2)
polygon(x,y,col="yellow",border = "yellow")
x=c(6.7,8.7,6.7)
y=c(2,0,-2)
polygon(x,y,col="yellow",border = "yellow")
x=c(6.2,6.2,3.2)
y=c(-3.2,-6.2,-6.2)
polygon(x,y,col="yellow",border = "yellow")
x=c(2,0,-2)
y=c(-6.7,-8.7,-6.7)
polygon(x,y,col="yellow",border = "yellow")
x=c(-3.2,-6.2,-6.2)
y=c(-6.2,-6.2,-3.2)
polygon(x,y,col="yellow",border = "yellow")
x=c(-6.7,-8.7,-6.7)
y=c(-2,0,2)
polygon(x,y,col="yellow",border = "yellow")
x=c(-6.2,-6.2,-3.2)
y=c(3.2,6.2,6.2)
polygon(x,y,col="yellow",border = "yellow")
#membuat lingkaran kuning
r=4.5
x0=0
y0=0
theta=seq(0,2*pi,length=1000)
a=x0+r*cos(theta)
b=y0+r*sin(theta)
polygon(a,b,col="yellow",border = "yellow")
#membuat setengah lingkaran merah
r=2.5
x0=0
y0=-1
theta=seq(0,pi,length=1000)
a=x0+r*cos(-theta)
b=y0+r*sin(-theta)
polygon(a,b,col="red",border = "red")
#membuat 2 setengah lingkaran hitam
r=1.6
x0=-2
y0=0.8
theta=seq(0,pi,length=1000)
a=x0+r*cos(theta)
b=y0+r*sin(theta)
polygon(a,b,col="black",border = "black")
r=1.6
x0=2
y0=0.8
theta=seq(0,pi,length=1000)
a=x0+r*cos(theta)
b=y0+r*sin(theta)
polygon(a,b,col="black",border = "black")
Output:
2. Syntax:
Bangkit_Weibull <- function(n, alpha, beta){
set.seed(123)
U = runif(n,0,1)
x=(-log(1-U)/alpha)^(1/beta)
return(x)
}
col=c('royalblue','salmon','rosybrown'),'topright')
Output:
3. Syntax:
#-----NOMOR 3--------
# Define the data
data <- array(data = c(109, 4, 116, 84), dim = c(2, 2))
data
for (i in 1:2) {
for (j in 1:2) {
Fe[i,j] <- (n[i]* m[j])/N
}
}
return(Fe)
}
return(chi_Sq)
}
# Hasil Pengujian
cat("====================================================
==========\n")
cat("Hipotesis Uji\n")
cat("Hipotesis_0: Tidak ada hubungan antara makan
sambal dan sakit perut\n")
cat("Hipotesis_1: Ada hubungan antara makan sambal dan
sakit perut\n")
cat("====================================================
==========\n")
cat("Tingkat Signifikansi\n")
cat("alpha = 0.05\n")
cat("====================================================
==========\n")
cat("Statistik Uji\n")
cat("Chi-Square =", chi_square(data), "\n")
cat("P-Value =", p_value(data), "\n")
cat("Critical Value =", critical_value(data, 0.05),
"\n")
cat("Odds Ratio =", odds_ratio(data), "\n")
cat("Lower Confidence Interval =",
confidence_interval(data, 0.05)[[1]], "\n")
cat("Upper Confidence Interval =",
confidence_interval(data, 0.05)[[2]], "\n")
cat("====================================================
==========\n")
cat("Kesimpulan\n")
if(p_value(data) < 0.05){
cat("Karena P-Value < alpha, maka hipotesis nol
ditolak\n")
cat("Maka ada hubungan antara makan sambal dan sakit
perut\n")
} else{
cat("Karena P-Value > alpha, maka hipotesis nol
diterima\n")
cat("Maka tidak ada hubungan antara makan sambal dan
sakit perut\n")
}
cat("====================================================
==========")
}
Output: