GenerateBOD {fitODBOD}R Documentation

Generate Overdispersed Binomial Outcome Data

Description

Using a three step algorithm to generate overdispersed binomial outcome data. When the number of frequencies, binomial random variable, probability of success and overdispersion are given.

Usage

GenerateBOD(N,n,pi,rho)

Arguments

N

single value for number of total frequencies

n

single value for binomial random variable

pi

single value for probability of success

rho

single value for overdispersion parameter

Details

The generated binomial random variables are overdispersed based on rhorho for the probability of success pipi.

Step 1: Solve the following equation for a given n,pi,rhon,pi,rho,

phi(z(pi),z(pi),delta)=pi(1pi)rho+pi2,phi(z(pi),z(pi),delta)=pi(1-pi)rho + pi^2,

For deltadelta where phi(z(pi),z(pi),delta)phi(z(pi),z(pi),delta) is the cumulative distribution function of the standard bivariate normal random variable with correlation coefficient deltadelta, and z(pi)z(pi) denotes the pithpi^{th} quantile of the standard normal distribution.

Step 2: Generate $n$-dimensional multivariate normal random variables, Zi=(Zi1,Zi2,ldots,Zin)TZ_i=(Z_{i1},Z_{i2},ldots,Z_{in})^T with mean 00 and constant correlation matrix SigmaiSigma_i for i=1,2,,N,i=1,2,\ldots,N, where the elements of (Sigmai)lm(Sigma_i)_{lm} are deltadelta for lml \ne m.

Step 3: Now for each j=1,2,,nj=1,2,\ldots,n define Xij=1;X_{ij} = 1; if Zij<z(π)Z_{ij} < z(\pi), or Xij=0;X_{ij} = 0; otherwise. Then, it can be showed that the random variable Yi=j=1nXijY_i=\sum_{j=1}^{n} X_{ij} is overdispersed relative to the Binomial distribution.

NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.

Value

The output of GenerateBOD gives a vector of overdispersed binomial random variables

References

Manoj C, Wijekoon P, Yapa RD (2013). “The McDonald generalized beta-binomial distribution: A new binomial mixture distribution and simulation based comparison with its nested distributions in handling overdispersion.” International journal of statistics and probability, 2(2), 24.

Examples

N <- 500    # Number of observations
n <- 10      # Dimension of multivariate normal random variables
pi <- 0.5   # Probability threshold
rho <- 0.1  # Dispersion parameter

# Generate overdispersed binomial variables
New_overdispersed_data <- GenerateBOD(N, n, pi, rho)
table(New_overdispersed_data)


[Package fitODBOD version 1.5.2 Index]