Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multivariate Bernoulli random numbers

    Dear Statalisters,

    Does anyone know how to generate random draws from a multivariate Bernoulli distribution with a known correlation structure in Stata?

    Any help would be greatly appreciated.

  • #2
    The question is trickier than it seems. There is -drawnorm- as a part of official Stata, which would allow draws for any arbitrary mulrivariate Normal distribution. These draws can then be transformed to a multivariate binomial distribution as an approximation. This approach is essentially what's being a Stata Journal article called "Generating nonnegatively correlated binary random variates" by M. Chen.

    Comment


    • #3
      Originally posted by Maxime Bercholz View Post
      Does anyone know how to generate random draws from a multivariate Bernoulli distribution with a known correlation structure in Stata?
      Yes.
      Code:
      search ovbd
      And it'll handle negative correlations, to boot. (See the ancillary do-file for examples.)

      If you plan to use it for some time, stay tuned for updates. I've been working on and off on a self-contained replacement for its dependence on -ridder-. If there's sufficient interest, I'll stop dawdling and get it finished and up to Kit.

      Comment


      • #4
        See also

        Lunn and Davies (1998). "Generate correlated Bernoulli regressors," Biometrika, 85, pp. 487-490

        Comment


        • #5
          Originally posted by Leonardo Guizzetti View Post
          The question is trickier than it seems. There is -drawnorm- as a part of official Stata, which would allow draws for any arbitrary mulrivariate Normal distribution. These draws can then be transformed to a multivariate binomial distribution as an approximation. This approach is essentially what's being a Stata Journal article called "Generating nonnegatively correlated binary random variates" by M. Chen.
          Thanks, Leonardo! I did think of using -drawnorm- but I was not sure how to transform the results into binary random numbers while preserving the correlation structure, or at least controlling it. This article looks like what I was looking for.

          I will also check out -ovbd- and that Lunn and Davies paper, thanks Joseph and Joao.

          Comment

          Working...
          X