How to generate correlated binary variables
- by jonalm
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.