Date: Dec 29, 2012 5:04 AM Author: Farjana Misu Subject: Simulating data Hi

If Z is logistic binary with probability P(Z=1|W)=1/(1+exp(2-5W)),

where W is uniform(0,1) then i have tried in this way to simulate Z.

rand('seed',1);

W=rand(500,1);

p=1./(1+exp(2-5*W));

for i=1:500;

Z(i)=random('bino',1,p(i),1,1);

end

Z;

Is it the correct way?