Jialu Zhang <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > Hello, > > I have a question on how to generate random binomial samples with known > variance-covariance structure. For example, y1, y2, ..., y10 all follow > binomial distribution Bin(n,p). n and p are given. Also some observations > are correlated. corr(yi,yi+1)=0.1, i=1,2,...9. > > I wonder if someone knows how to generate these random numbers. > > Many thanks in advance. > > Jialu
Let X1,X2,X3,X4,Y be independent and identical random variables from any distribution which has a mean m and a variance v. Now let Z1 be Y + X2 and Z1 be Y + X4 with probability p, else let Z1 be X1 + x2 and Z2 be X3 + X4. Then E(Z1.Z1)-E(Z1).E(Z2) = p.E(Y^2+Y(x2+x4)+X2.X4) + (1-p).E((X1+X2).(X3+X4)) - 4.m^2 = p.[v+m^2+2m^2+m^2]+(1-p).4.m^2-4.m^2 = p.v and the correlation is p/2. So 1 possibility for n even is as follows. Generate a uniform rv U. If U < 0.2 then let Z1 = X1+X2, Z2 = X2+X3, ...Z9 = X9+X10, Z10 = X10+X11 where X1..X11 are generated as B(n/2,p) rvs else generate Z1..Z10 as B(n,p) rvs. Ian Smith . . ================================================================= Instructions for joining and leaving this list, remarks about the problem of INAPPROPRIATE MESSAGES, and archives are available at: . http://jse.stat.ncsu.edu/ . =================================================================
