help ovbdVersion 1.0 2007-02-27 -------------------------------------------------------------------------------

Title

ovbd

Generate correlated random binomial variables

Syntax

ovbd[newvarlist],means(name)corr(name)n(#)[options]clear

optionsDescription ------------------------------------------------------------------------- Mainmeans(name)row vector of mean values (proportions)corr(name)correlation coefficient matrixn(#)# of observations to be generatedclearmandatory reminder that the dataset will be overwrittenOptions

stub(string)stub for new variable namesseed(#)seed for random-number generatorverboseverbose root-finder output -------------------------------------------------------------------------

Description

ovbdgenerates correlated random binomial variables using the algorithm of Ahn and Chen (1995) as described by Gregori, Di Consiglio and Carmeci (1995).

Options+------+ ----+ Main +-------------------------------------------------------------

meansthe name of a row vector containing the desired proportions in the variables containing the resulting correlated random binomial variables; proportions the row vector must be in the same order as the the corresponding variables innewvarlist, if used.

corrthe name of a symmetric matrix containing the desired correlation coefficients.

nan integer specifying the desired number of observations.

stubstub for new variable names ifnewvarlistis not specified. At least one ofstub()ornewvarlistmust be specified. Ifnewvarlistis specified, thenstub()is ignored.

seedseed for random number generator; a seed value of zero is ignored.

verboserequests diplay of output fromridder, which is called byovbd; primarily for diagnostic purposes when Ridder's method fails.

clearnot optional; the user's acknowledgment the dataset will be cleared, as will any global macroS_1that the user has defined. Despite this forced option, none of thenewvarlistmay be present in the dataset. (clearmight become truly optional in a later version ofovbd.)

Remarks

ovbdfollows the algorithm of Ahn and Chen (1995), and is roughly modeled after the implementation described by Gregori, Di Consiglio and Carmeci (1995), from whose Fortran-77 subroutine the Stata command's name derives.

ovbdcallsridder, which, in turn, calls the Stata functionbinormal(), in order to find the bivariate normal correlation coefficients that will give rise to the desired correlations between the end-result pairs of binomial variables. Finding this correlation coefficient for each pair is not guaranteed to be successful;verbosewill show the pair (matrix elements) where the root-finding exercise fails first. This might aid in finding a more judicious construction of the mean vector and correlation matrix to feed toovbd.The command also calls

drawnormin order to generate the correlated normal variables used in creating the corresponding correlated binomial variables. The option to usenewvarlistfollows the convention of the latter, and allows greater flexibility in naming the new variables, but the use ofstub()might be more convenient for workaday use.

ReferencesH. Ahn and J. J. Chen, Generation of overdispersed and underdispersed binomial variables.

Journal of Computational and Graphical Statistics4:55–64, 1995.D. Gregori, L. Di Consiglio and G. Carmeci, A Fortran77 routine for overdispersed binary data generation. Presented at the

1st Conference ofthe Biometric Society, Italian RegionJune 16 and 17, 1995. http://lib.stat.cmu.edu/general/corbin

Examples

. ovbd a b c, means(A) corr(B) n(250) clear

. ovbd , st(response_) means(A) corr(B) n(200) seed(12345) clear

AuthorJoseph Coveney jcoveney@bigplanet.com

Also seeManual:

[D] drawnorm,[P] matrixOnline:

ridder,drawnorm,matrix,nbreg,rnd(if installed),ebb(if