# zoib

### Author: Maarten L. Buis

zoib fits by maximum likelihood a zero-one inflated beta distribution to a distribution of a variable depvar. depvar ranges between 0 and 1: for example, it may be a proportion. zoib will estimate the probabilities of having the value 0 and/or 1 as separate processes. The logic is that we can often think of proportions of 0 or 1 as being qualitatively different and generated through a different process as the other proportions.

This package can be installed by typing in Stata: ssc install zoib

### Example

```
. use "http://fmwww.bc.edu/repec/bocode/k/k401.dta", clear
(source: Papke and Wooldridge 1996)

. replace totemp = totemp / 10000

.
. zoib prate mrate totemp age sole, oneinflate( mrate totemp age sole) robust

Iteration 0:   log pseudolikelihood = -1759.3734
Iteration 1:   log pseudolikelihood = -1299.8822
Iteration 2:   log pseudolikelihood =   -1293.69
Iteration 3:   log pseudolikelihood = -1293.6594
Iteration 4:   log pseudolikelihood = -1293.6594

ML fit of oib                                     Number of obs   =       4734
Wald chi2(4)    =     136.47
Log pseudolikelihood = -1293.6594                 Prob > chi2     =     0.0000

------------------------------------------------------------------------------
|               Robust
prate |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
proportion   |
mrate |   .1524644   .0466905     3.27   0.001     .0609527     .243976
totemp |  -.0265332   .0092522    -2.87   0.004    -.0446673   -.0083992
age |   .0216248   .0020206    10.70   0.000     .0176645    .0255852
sole |   .0604715   .0376378     1.61   0.108    -.0132972    .1342402
_cons |   .8738362   .0354738    24.63   0.000     .8043088    .9433636
-------------+----------------------------------------------------------------
oneinflate   |
mrate |   .7935556   .0653962    12.13   0.000     .6653814    .9217297
totemp |  -.1416409   .0354509    -4.00   0.000    -.2111235   -.0721584
age |    .020835    .003494     5.96   0.000     .0139869    .0276832
sole |   .9044132   .0654829    13.81   0.000     .7760692    1.032757
_cons |  -1.472011   .0702084   -20.97   0.000    -1.609617   -1.334405
-------------+----------------------------------------------------------------
ln_phi       |
_cons |    1.77591   .0358677    49.51   0.000     1.705611     1.84621
------------------------------------------------------------------------------

.
. // effect on total proportion
. mfx, predict(pr) at(mean sole = 0)

Marginal effects after zoib
y  = Proportion (predict, pr)
=  .85369833
------------------------------------------------------------------------------
variable |      dy/dx    Std. Err.     z    P>|z|  [    95% C.I.   ]      X
---------+--------------------------------------------------------------------
mrate |   .0566366      .00679    8.34   0.000   .043326  .069947   .746335
totemp |  -.0100315      .00208   -4.83   0.000  -.014104 -.005959   .462107
age |   .0034952      .00031   11.37   0.000   .002893  .004098   13.1398
sole*|    .053115       .0047   11.31   0.000   .043908  .062322         0
------------------------------------------------------------------------------
(*) dy/dx is for discrete change of dummy variable from 0 to 1

.
. // effect on probability of having a proportion 1
. mfx, predict(pr1) at(mean sole = 0)

Marginal effects after zoib
y  = probability of having value 1 (predict, pr1)
=  .33817515
------------------------------------------------------------------------------
variable |      dy/dx    Std. Err.     z    P>|z|  [    95% C.I.   ]      X
---------+--------------------------------------------------------------------
mrate |   .1776078      .01555   11.42   0.000   .147125  .208091   .746335
totemp |   -.031701      .00796   -3.98   0.000  -.047304 -.016098   .462107
age |   .0046631      .00078    6.01   0.000   .003143  .006184   13.1398
sole*|   .2198069      .01548   14.20   0.000   .189476  .250138         0
------------------------------------------------------------------------------
(*) dy/dx is for discrete change of dummy variable from 0 to 1

.
. // effect on proportion given proportion < 1
. mfx, predict(prcond) at(mean sole = 0)

Marginal effects after zoib
y  = proportion conditional on not having value 0 or 1 (predict, prcond)
=    .778942
------------------------------------------------------------------------------
variable |      dy/dx    Std. Err.     z    P>|z|  [    95% C.I.   ]      X
---------+--------------------------------------------------------------------
mrate |   .0262531      .00781    3.36   0.001   .010948  .041558   .746335
totemp |  -.0045688       .0016   -2.86   0.004  -.007698 -.001439   .462107
age |   .0037236      .00035   10.57   0.000   .003033  .004414   13.1398
sole*|   .0102369      .00632    1.62   0.105  -.002149  .022623         0
------------------------------------------------------------------------------
(*) dy/dx is for discrete change of dummy variable from 0 to 1

[do-file]```