Hi, I have a set of N objects randomly distributed in a 2D physical space. Each object (i) generates a bernoulli random number (0 or 1) based on a marginal probability Pr(xi = 1) = p. These objects a correlated by physical distance. The closer the objects are, the larger their correlation is. E.g. If objects i and j are co-located, they are expected to generate correlated results. For Example, if P(Xi=1)= 0.6 and P(Xj=1)=0.3 they would produce something like: Xi= 0 1 0 1 1 1 0 1 0 1 Xj= 0 1 0 0 0 1 0 1 0 0 Such that Pr(Xi|Xj)=1 On the other hand if i and j are distant they would produce uncorrelated results such that Pr(Xi|Xj)=Pr(Xi) I have tried to use some of the packages in Matlab (Sampling from multivariate correlated binary and poisson random variables) and R (bindata) but I could not produce an acceptable correlation matrix. Any ideas how I can produce an acceptable correlation matrix? BTW, I have checked the following earlier posts https://mathoverflow.net/questions/18268/discrete-stochastic-process-exponentially-correlated-bernoulli and https://mathoverflow.net/questions/19406/constructing-bernoulli-random-variables-with-prescribed-correlation But I am not sure how I can relate to them. Thanks