# R kemungkinan normal

Aug 31st, 2014
289
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. mungkin=function(sd1,n1,xbar1,value1,value2)
2. {
3.     es1 = sd1/(sqrt(n1))
4.     z1 = (value1-xbar1)/es1
5.
6.     cat("Jumlah sample: ", n1); cat("   trunc 2: ", round(n1,2))
7.     cat("\n")
8.
9.     cat("Population mean: ", xbar1); cat("   trunc 2: ", round(xbar1,2))
10.     cat("\n")
11.
12.     cat("Population standard deviation: ", sd1); cat("   trunc 2: ", round(sd1,2))
13.     cat("\n")
14.
15.     cat("Nilai batas kiri: ", value1); cat("   trunc 2: ", round(value1,2))
16.     cat("\n")
17.
18.     cat("Nilai batas kanan: ", value2); cat("   trunc 2: ", round(value2,2))
19.     cat("\n");cat("\n")
20.
21.     cat("Standard Error: ", es1); cat("   trunc 2: ", round(es1,2))
22.     cat("\n")
23.     cat("Nilai Z kritis kiri: ", z1); cat("   trunc 2: ", round(z1,2))
24.     cat("\n")
25.     z2 = (value2-xbar1)/es1
26.     cat("Nilai Z kritis kanan: ", z2); cat("   trunc 2: ", round(z2,2))
27.     cat("\n");cat("\n")
28.     kemungkinan=pnorm(z2)-pnorm(z1)
29.     cat("Nilai kemungkinan: ", kemungkinan); cat("   trunc 2: ", round(kemungkinan,2))
30.     cat("\n")
31.     cat("Nilai kemungkinan dalam persen: ", 100*kemungkinan);
32.     cat("   trunc 2: ", round(kemungkinan*100,2))
33.     cat("\n")
34. }