# BI: The Binomial distribution with optional Dispersion Parameter In PROreg: Patient Reported Outcomes Regression Analysis

## Description

Density and random generation for the binomial distribution with optional dispersion parameter.

## Usage

 ```1 2``` ```dBI(m,p,phi) rBI(k,m,p,phi) ```

## Arguments

 `k` number of simulations. `m` number of trials in each binomial observation. `p` probability parameter of the binomial distribution. `phi` dispersion parameter of the binomial distribution. If `phi`=1, the binomial distribution without dispersion parameter will be considered. Default 1.

## Details

The binomial distribution belongs to the exponential family of distributions. Consequenlty, although the usual binomial distribution only consists of two paramters, an additional dispersion parameter can be included. The inclusion of a dispersion parameter softens the relationship between the expectation and variance that the binomial distribution keeps, i.e. the model allows overdispersion to be included,

E[y]=mp, Var[y]=phi*mp(1-p).

The density function of the binomial distribution with dispersion parameter is based on the exponential family approach and it is defined as

f(y)=exp\{[y*log(p/(1-p))+m*log(1-p)]/phi+c(y,phi)\},

where c() is a function that it is approximated with the deviance of the model by quadratic approximations of the log-likelihood function.

## Value

`dBI` gives the density of the binomial distribution for those `m`, `p` and `phi` parameters.

`rBI` generates `k` random observations based on a binomial distribution for those `m`, `p` and `phi` parameters.

## Author(s)

J. Najera-Zuloaga

D.-J. Lee

I. Arostegui

## References

Pawitan Y. (2001): In All Likelihood: Statistical Modelling and Inference Using Likelihood. Oxford University Press

The `rbinom` functions of package `stats`. This function performs simulations based on a binomial distribution without dispersion parameter.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16``` ```k <- 1000 m <- 10 p <- 0.765 phi <- 4.35 #simulating y <- rBI(k,m,p,phi) y #density function d <- dBI(m,p,phi) d #plot the simulated variable and fit the density hist(y,col="lightgrey") lines(seq(0,m),k*d,col="blue",lwd=2) ```

### Example output

```   [1]  9  6  8  4  8  9  6  9  5  3  4  5  7  8  8  7  8  4  8  9  7  8  3  8
[25]  4  8  6  8  7  9  5  7 10  8  9  6  3  8  6  9 10 10 10  4  8  8  6 10
[49]  8  8  8  3  7  4  7  8  9  4  6  6 10  8  9  6  9  7  9 10  7  5  9  9
[73]  8  6  9  6 10  5  7  6  3 10 10  8  6  3  5  8  8  3 10  9  8  9  9  8
[97]  5 10  5  9  7  9  5  8  4  9  2  7  2  9  6 10  9 10  8  6  8  9 10  6
[121]  7  7 10  2  6  7  9  6  9  6  5  3  7  3  5  2  9  6  8  7  6  4  8  5
[145] 10  9  9  8  5  8  9  8  8  5  0  8  5 10  8  7  7  5  7 10  9 10  5  8
[169]  9  9  6  4  8  7  4  6  2 10  9  9  5 10 10  7 10  7  8 10  5  4  9  5
[193]  8 10 10  6  9  7  9  3  5  9  6  5  3  6  9  7  8  3  6  4  3  8  9  8
[217]  7  5  8  9  1  7  6  3  4  2  9  7  7  2  9  6 10  8  3  2  5  7  8  9
[241]  3  8  4  5  2  6  9  4 10  8  3  5 10  6  7  6  8  8  8  4  7  2  9  5
[265]  6  5  6  9  5  6  9  4  8  6  8  6  6  2  2  9  8  6  3  6  9  7  7  3
[289]  7  8  7  9  6  6  7  3  9  9  9 10  3 10  8  4 10  9  5  4  9 10  8  1
[313]  3  6  9  4  8 10 10  6  8  8  8  9  8  3  4  8  7  3 10  6  6  9  3  8
[337]  5  9  9  6  6  8  7  5  3  7  8  7  9  8 10 10  8  5  9  9  6  8  7  6
[361]  9  4  8  6  9  8  7  9  6  1  6  7  6  5  7  2  5  5  3  7 10  8 10  5
[385]  3  8  9 10  7  3  3  8  6  6  7  9  3  6  7  4  7  6  6  4  7  5  2  8
[409]  7  9  7  8  8  8  4  4 10  5  4 10  3  8  5 10  7  5  6  6  5  3  8  9
[433]  5  7  2  7  6  9  7  8  6  5  7  6  6  7  2  4 10  7  8  9 10  8  8  7
[457]  8  4  7  7  6  4  4  8  9  7  4  8  8  8  7  4  7  7  8  7  6 10  1  9
[481]  8  7  5  6  8 10  8  4  8  1  2  7  5  9  9  8  7 10  7  8  6  8  5  5
[505]  6  9  6  8  8  9  3  7  3  9  5  5  3  5  4  5  5  6  6  7  9  8  9  9
[529]  7  2  6 10  8  5  6  7  9  6  6  7  8  5  9  6  7  6  1  9  9  8  3  5
[553]  5  6 10  4  9  7  3 10  6  3  9 10  5  3  9  4  9  9  9  9  5  7  9  5
[577] 10  5  9  7  6  8  2  4  5  5  5  9 10  7  4  8  5  8  6  4  9  3  5  7
[601]  8  6  9  7 10 10  5  4  6 10  7  4  2  8  8  9  4  7 10  5  9  6  6 10
[625]  8  7  5  6  7  1  9  8  8  8 10  7  8  8  8  2  7  5  7  9  7 10  7  7
[649] 10  6  2  4  4  8  6 10  9  8  6  6  9  6  1  9 10  6  3  8  8  7  9  5
[673]  7  2 10  8  8  8 10  5  8  9  9  3  6  7 10 10  5 10  4  9 10  7  8  6
[697]  7  2  9 10  8  5  8  6  0  5  8  5  9  7  9  9 10  8  9  9  5  4 10  2
[721]  5  9  7  7  9 10  8  8  6  6  3  9  7  8  5  3  3  3  9  2  9  9  7  6
[745]  8 10  3  5  8  7  7  5  7  9  7  5  6  8  9  7 10  6  1 10  0 10  9  6
[769]  5  4 10  2  3  6  4  9  5  6  6  7  4 10  7  6  6  9  7  4  6  3  9  3
[793]  1  9  4  7  9  7  9  7  7  6  8  9  7  8  9  9  9  7 10  3  8  5  7  6
[817]  9  6 10  9  0 10  7  6  9  5  5 10  5  7  5  6  3  6  8  8 10  7  5  5
[841]  7  6  7  7  8  8  5  4  3 10  5  2  8  9  5  6  4  8  7  5  7  3  7  1
[865]  6  8  8  8  4  9  8  5 10  5  9  6  2  8  3  5  7  6  8 10  5  4  4  8
[889]  8  7  6  8  9 10  9  8  8  4  9  9  5  7  9  6  8  8  4  5  5  8  4  8
[913]  5  5 10  6  5  9  8  8 10  5  8 10  8  5  3 10  1  5  5  5 10  6  8  9
[937] 10  3  9  4  7  4  6  6  6  6  5  9  8  8  6 10  6  3 10  4  8  6  8  9
[961]  6  4  3  7  9 10  5  7  6  8  4  6  7  7  2  7  4  7  6  8  1  9  3 10
[985]  7  6  7  9  5 10  9 10  5  5  8  3  8  7  4  8
[1] 0.005896506 0.016330072 0.032052418 0.054197733 0.082009713 0.112669341
[7] 0.141104382 0.160446975 0.163262489 0.143116239 0.088914131
```

PROreg documentation built on July 1, 2020, 7:02 p.m.