4-3. Exercises
Ex 1. 1μμ 6κΉμ§ λ²νΈκ° μ νμλ λμΌν 6κ°μ κ³΅μ΄ λ€μ΄ μλ μμμμ μμλ‘ λ κ°μ 곡μ κΊΌλμ λ λμ¨ λ²νΈμ νκ· μ λΌ νμ.
μ νλ₯ λΆν¬ν¨μλ₯Ό ꡬνμμ€.
μ κΈ°λκ°κ³Ό λΆμ°μ ꡬνμμ€.
κ° 4 μ΄μμΌ νλ₯ μ ꡬνμμ€.
Ex 2. 1μμ 6κΉμ§ λ²νΈκ° μ νμλ λμΌν 6κ°μ κ³΅μ΄ λ€μ΄ μλ μμμμ μμλ‘ λ κ°μ 곡μ κΊΌλμ λ λμ¨ λ²νΈ μ€ ν° μ«μλ₯Ό XλΌ νμ.
μ νλ₯ λΆν¬ν¨μλ₯Ό ꡬνμμ€.
μ κΈ°λκ°κ³Ό λΆμ°μ ꡬνμμ€.
κ° 4 μ΄μμΌ νλ₯ μ ꡬνμμ€.
Ex 3. 1μμ 20κΉμ§ λ²νΈκ° μ νμλ λμΌν 20κ°μ κ³΅μ΄ λ€μ΄ μλ μμμμ μμλ‘ n κ°μ 곡μ κΊΌλμ λ λμ¨ λ²νΈμ νκ· μ μ΄λΌ νμ.
n=2, 5, 10 κ°κ°μ λνμ¬, μ νλ₯ λΆν¬ν¨μλ₯Ό κ·Έλνλ‘ μμ±νμ¬ λΉκ΅νλΌ.
n=2, 5, 10 κ°κ°μ λνμ¬, μ κΈ°λκ°κ³Ό λΆμ°μ ꡬνμ¬ λΉκ΅νλΌ.
n=2, 5, 10 κ°κ°μ λνμ¬, μ΄ 15 μ΄μμΌ νλ₯ μ ꡬνμ¬ λΉκ΅νλΌ.
[ Solution ]
library(Rstat)
# 20 Balls
ball <- 1:20
S2 <- urnsample2(ball, size=2); (N2 <- nrow(S2))
S5 <- urnsample2(ball, size=5); (N5 <- nrow(S5))
S10 <- urnsample2(ball, size=10); (N10 <- nrow(S10))
S15 <- urnsample2(ball, size=15); (N15 <- nrow(S15))
# Sample Mean and Probability Distribution
X2 <- apply(S2,1,mean); T2 <- table(X2); P2 <- T2/N2; v2 <- as.numeric(names(T2))
X5 <- apply(S5,1,mean); T5 <- table(X5); P5 <- T5/N5; v5 <- as.numeric(names(T5))
X10 <- apply(S10,1,mean); T10 <- table(X10); P10 <- T10/N10; v10 <- as.numeric(names(T10))
X15 <- apply(S15,1,mean); T15 <- table(X15); P15 <- T15/N15; v15 <- as.numeric(names(T15))
# Probability Distribution Plot
pmax <- max(c(P2,P5,P10,P15))
win.graph(9,6); par(mfrow=c(2,2)); par(mar=c(2,2,3,2))
plot(v2, P2, type="h", main="n=2", ylim=c(0,pmax), xlim=c(1,20), lwd=2, col=2)
plot(v5, P5, type="h", main="n=5", ylim=c(0,pmax), xlim=c(1,20), lwd=2, col=2)
plot(v10, P10, type="h", main="n=10", ylim=c(0,pmax), xlim=c(1,20), lwd=2, col=2)
plot(v15, P15, type="h", main="n=15", ylim=c(0,pmax), xlim=c(1,20), lwd=2, col=2)
# Expected Value and Variance
disc.exp(v2,T2); disc.exp(v5,T5); disc.exp(v10,T10); disc.exp(v15,T15)
# P(X>=15)
PX2 <- sum(P2[v2 >= 15]); PX5 <- sum(P5[v5 >= 15])
PX10 <- sum(P10[v10 >= 15]); PX15 <- sum(P15[v15 >= 15])
cat(PX2, PX5, PX10, PX15, "\n")
> # Expected Value and Variance
> disc.exp(v2,T2); disc.exp(v5,T5); disc.exp(v10,T10); disc.exp(v15,T15)
## E(V2) = 1995/190 = 10.5
## V(V2) = 23940/190 - 10.5Β² = 15.75
## D(V2) = β(15.75) = 3.969
## E(V5) = 162792/15504 = 10.5
## V(V5) = 1790712/15504 - 10.5Β² = 5.25
## D(V5) = β(5.25) = 2.291
## E(V10) = 1939938/184756 = 10.5
## V(V10) = 20692672/184756 - 10.5Β² = 1.75
## D(V10) = β(1.75) = 1.323
## E(V15) = 162792/15504 = 10.5
## V(V15) = 1718360/15504 - 10.5Β² = 0.583
## D(V15) = β(0.583) = 0.764 All has the same
Variance decreases as increases.
> # P(X>=15)
> PX2 <- sum(P2[v2 >= 15]); PX5 <- sum(P5[v5 >= 15])
> PX10 <- sum(P10[v10 >= 15]); PX15 <- sum(P15[v15 >= 15])
> cat(PX2, PX5, PX10, PX15, "\n")
## 0.1578947 0.02631579 0.0001028383 0 decreases rapidly as increases.
Last updated
Was this helpful?