ppoibin: The Poisson Binomial Distribution.

Description Usage Arguments Details Value Author(s) References Examples

View source: R/funs.R

Description

The cdf, pmf, quantile function, and random number generation for the Poisson binomial distribution.

Usage

1
2
3
4
ppoibin(kk, pp, method = "DFT-CF",wts=NULL)
dpoibin(kk, pp,wts=NULL)
qpoibin(qq, pp,wts=NULL)
rpoibin(m, pp,wts=NULL)

Arguments

kk

The values where the cdf or pmf to be evaluated.

pp

The vector for p_j's which are the sucess probabilities for indicators.

method

"DFT-CF" for the DFT-CF method, "RF" for the recursive formula, "RNA" for the refined normal approximation, "NA" for the normal approximation, and "PA" for the Poisson approximation.

wts

The weights for p_j's.

qq

The values where the quantile function to be evaluated.

m

The number of random numbers to be generated.

Details

See the reference for computational details.

Value

Returns the entire cdf, pmf, quantiles, and random numbers.

Author(s)

Yili Hong [aut, cre], R Core Team [aut, cph]

References

Hong, Y. (2013). On computing the distribution function for the Poisson binomial distribution. Computational Statistics & Data Analysis, Vol. 59, pp. 41-51.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
   kk=0:10
   pp=c(.1,.2,.3,.4,.5)
   ppoibin(kk=kk, pp=pp, method = "DFT-CF",wts=rep(2,5))
   ppoibin(kk=kk, pp=pp, method = "RF",wts=rep(2,5))
   ppoibin(kk=kk, pp=pp, method = "RNA",wts=rep(2,5))
   ppoibin(kk=kk, pp=pp, method = "NA",wts=rep(2,5))
   ppoibin(kk=kk, pp=pp, method = "PA",wts=rep(2,5))
   dpoibin(kk=kk, pp=pp,wts=rep(2,5))
   qpoibin(qq=0:10/10,pp=pp,wts=rep(2,5))
   rpoibin(m=2,pp=pp,wts=rep(2,5))

Example output

 [1] 0.02286144 0.13517280 0.37211652 0.65383500 0.86212984 0.96181016
 [7] 0.99294500 0.99918348 0.99994720 0.99999856 1.00000000
 [1] 0.02286144 0.13517280 0.37211652 0.65383500 0.86212984 0.96181016
 [7] 0.99294500 0.99918348 0.99994720 0.99999856 1.00000000
 [1] 0.02812958 0.13669805 0.37078646 0.65398594 0.86019757 0.95840421
 [7] 0.99114093 0.99873860 0.99988766 0.99999400 0.99999981
 [1] 0.03486268 0.13825024 0.35840026 0.64159974 0.86174976 0.96513732
 [7] 0.99444416 0.99945199 0.99996698 0.99999879 0.99999997
 [1] 0.04978707 0.19914827 0.42319008 0.64723189 0.81526324 0.91608206
 [7] 0.96649146 0.98809550 0.99619701 0.99889751 0.99970766
 [1] 0.02286144 0.11231136 0.23694372 0.28171848 0.20829484 0.09968032
 [7] 0.03113484 0.00623848 0.00076372 0.00005136 0.00000144
 [1]  0  1  2  2  3  3  3  4  4  5 10
[1] 5 5

poibin documentation built on Jan. 9, 2020, 1:09 a.m.