1. Negative Binomial Distribution
κΈ°νλΆν¬μ κ°λ
μ λ³΄λ€ μΌλ°νν΄μ r λ²μ§Έ μ±κ³΅μ΄ λ°μν λκΉμ§ μννλ λ
립μνμ νμλ₯Ό X λΌ νλ©΄, νλ₯ λ³μ Xλ λ€μκ³Ό κ°μ μμ΄νλΆν¬(Negative Binomial Distribution)λ₯Ό λ°λ₯Έλ€.
[ μ΄λ₯Ό XβΌNB(p,r) λ‘ νκΈ°νλ€. ]
xλ²μ§Έ μνμμ rλ²μ§Έ μ±κ³΅μ΄ λ°μνλ €λ©΄ κ·Έ μ΄μ μ (xβ1) λ²μ μνκΉμ§ (rβ1)λ²μ 'μ±κ³΅'μ΄ λμμΌ νκ³ , λ§μ§λ§ μνμμ 'μ±κ³΅'μ΄ λμμΌ νλ€.
P(X=x) = P(x-1 λ²μ \space μν \spaceμ€μμ \spacer-1λ²μ\space μ±κ³΅)P(xλ²μ§Έ \spaceμνμ\space 'μ±κ³΅')
=(rβ1xβ1β)prβ1(1βp)xβrΓp, x=r,r+1,r+2,...
μμ΄νλΆν¬(Negative Binomial Distribution)λ μ±κ³΅νλ₯ μ΄ μΌμ ν μνμμ μ£Όμ΄μ§ νμ(r)μ μ±κ³΅μ΄ λ°μν λκΉμ§ μνν νμμ νλ₯ λΆν¬λ‘ λ€μκ³Ό κ°μ νλ₯ λ°λν¨μλ₯Ό κ°λλ€.
f(x)=(rβ1xβ1β)pr(1βp)xβr, x=r,r+1,r+2,...
2. Geometric Distribution and Negative Binomial Distribution
X1β,X2β,...,Xnβ μ΄ λ
립μ΄κ³ λμΌν κΈ°νλΆν¬(Geometric Distribution)λ₯Ό λ°λ₯΄λ νλ₯ λ³μμΌ λ, X=Ξ£i=1rβXiβ μ λΆν¬λ μμ΄νλΆν¬(Negative Binomial Distribution)λ₯Ό λ°λ₯Έλ€.
3. Expected Value and Variance of Negative Binomial Distribution
E(X)=E(Ξ£i=1rβXiβ)=r/p,
Var(X)=Var(Ξ£i=1rβXiβ)=r(1βp)/p2.
EXAMPLE 27. μ±κ³΅νλ₯ μ΄ 0.4μΈ λ¬΄νλͺ¨μ§λ¨μμ κ°κ° 1ν, 2ν, 4νμ μ±κ³΅μ μ»μ λκΉμ§ μννμμ λ, μννμμ νλ₯ λΆν¬ κ·Έλνλ₯Ό μμ±νκ³ , κΈ°λκ°κ³Ό λΆμ°μ ꡬνμ¬ λΉκ΅νλΌ.
[ Solution ]
library(Rstat)
# p, r, range of x
p <- 0.4; r <- c(1, 2, 4); xr <- 1:100
len <- length(r)
# dnbinom() : failures before the r-th success
fx <- list()
for (i in 1:len) fx[[i]] <- dnbinom(xr - r[i], r[i], p)
# Sum(fx) == 1 ?
sapply(fx, sum)
# Plot
mt <- paste0("Neg-Binomial(0.4,", r, ")")
win.graph(9,3); par(mfrow=c(1,3)); par(mar=c(3,4,4,2))
for (k in 1:len) plot(xr[1:30], fx[[k]][1:30], type="h",
main=mt[k], ylab="f(x)", xlab="", lwd=3, col=2)
# E(X) and Var(X)
disc.mexp(xr, fx, plot=F)
κΈ°νλΆν¬μ²λΌ μ€λ₯Έμͺ½ κΌ¬λ¦¬κ° κΈΈκ³ , μΌμͺ½μΌλ‘ μΉμ°μΉ ννλ₯Ό λνλ΄μ§λ§, λͺ©ν μ±κ³΅νμ( r )κ° μ»€μ§μλ‘ μΉμ°μΉ¨μ΄ μ€μ΄λ€κ³ μμμ μ μ μλ€.
> # E(X) and Var(X)
> disc.mexp(xr, fx, plot=F)
## E(XR) = 2.5 V(XR) = 10 - 2.5Β² = 3.75 D(XR) = β(3.75) = 1.936
## E(XR) = 5 V(XR) = 32.5 - 5Β² = 7.5 D(XR) = β(7.5) = 2.739
## E(XR) = 10 V(XR) = 115 - 10Β² = 15 D(XR) = β(15) = 3.873
κΈ°λκ°μ λͺ©ν μ±κ³΅νμμ λΉλ‘νμ¬ μ¦κ°ν¨.
λΆμ° λν λͺ©ν μ±κ³΅νμμ λΉλ‘νμ¬ μ¦κ°ν¨.
EXAMPLE 28. μ±κ³΅νλ₯ μ΄ κ°κ° 0.1μΈ μΈ κ°μ νλ‘μ νΈλ₯Ό μ±κ³΅μν¬ λκΉμ§ κΈ°νν νμ X μ λνμ¬ λ€μμ ꡬνμμ€.
10λ²μ§Έ μλ λ§μ 3 κ°μ νλ‘μ νΈλ₯Ό μ±κ³΅μν¬ νλ₯
[ Solution ]
f(x)=(3β1xβ1β)(0.1)3(0.9)xβ3, x=3,4,5,...
E(X)=r/p=3/0.1=30,
Var(X)=r(1βp)/p2=3Γ(0.9)/(0.1)2=270
f(10)=(3β110β1β)(0.1)3(0.9)10β3β0.017
library(Rstat)
# p, r, range of x
p <- 0.1; r <- 3; xr <- 3:250
# dnbinom() : failures before the r-th success
fx <- dnbinom(xr - r, r, p)
disc.exp(xr, fx)
# f(10)? :
xr <- 10
dnbinom(xr-r, r, p)
> # dnbinom() : failures before the r-th success
> fx <- dnbinom(xr - r, r, p)
> disc.exp(xr, fx)
## E(XR) = 30
## V(XR) = 1170 - 30Β² = 270
## D(XR) = β(270) = 16.432
> # f(10)? :
> xr <- 10
> dnbinom(xr-r, r, p)
## [1] 0.01721869