How to generate correlated binary variables
        Posted  
        
            by jonalm
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by jonalm
        
        
        
        Published on 2010-03-14T07:33:07Z
        Indexed on 
            2010/03/14
            7:35 UTC
        
        
        Read the original article
        Hit count: 291
        
Dear All
I need to generate a series of N random binary variables with a given correlation function. Let x = {x_i} be a series of binary variables (taking the value 0 or 1, i running form 1 to N). The marginal probability is given Pr(x_i = 1) = p, and the values should be correlated in the following way
E[ x_i x_j ] = const * |i-j|^-alfa
where alfa is a positive number.
Is it possible to generate a series like this? preferably in python.
© Stack Overflow or respective owner