Re: [R] Generating a binomial random variable correlated with a

2005-04-18 Thread Giovanni Petris
You may generate a single standard normal random variable Z and set X = (Zx). According to back-of-the-envelope calculations, the two have a correlation of exp(-x^2/2)/sqrt(2*pi*pnorm(x)*(1-pnorm(x))) which goes from a maximum of about 0.79 at x=0 to 0 for x going to infinity. If you aim at

RE: [R] Generating a binomial random variable correlated with a

2005-04-18 Thread Mohammad A. Chaudhary
Dear: Thank you very much for your 'generous' help. Overall I have learnt the limits of the solution to my problem. I was not feeling compfortable how I was going around with the problem. Bill and Ted provided a wonderful insight into what I was accomplishing and provided alternative solutions.

RE: [R] Generating a binomial random variable correlated with a

2005-04-17 Thread Ted Harding
On 16-Apr-05 Ashraf Chaudhary wrote: Ted: Thank you for your help. All I want is a binomial random variable that is correlated with a normal random variable with specified correlation. By linear I mean the ordinary Pearson correlation. I tried the following two methods, in each case the

RE: [R] Generating a binomial random variable correlated with a

2005-04-17 Thread Ted Harding
On 17-Apr-05 Ted Harding wrote: [...] So I'd suggest experimenting on the following lines. 1. Let X1 be a sample of size N using rbinom(N,1,p) (where, in general, p need not be 0.5) 2. Let Y be a sample of size N using rnorm(N,mu,sigma) (and again, in general, mu need not be 0 nor

RE: [R] Generating a binomial random variable correlated with a

2005-04-16 Thread Ashraf Chaudhary
@stat.math.ethz.ch Subject: RE: [R] Generating a binomial random variable correlated with a On 15-Apr-05 Ashraf Chaudhary wrote: Hi, I am posting this problem again (with some additional detail) as I am stuck and could not get it resolved as yet. I tried to look up in alternative sources

RE: [R] Generating a binomial random variable correlated with a

2005-04-04 Thread Ted Harding
On 03-Apr-05 Ashraf Chaudhary wrote: Hi All: I would like to generate a binomial random variable that correlates with a normal random variables with a specified correlation. Off course, the correlation coefficient would not be same at each run because of randomness. I greatly appreciate your

Re: [R] Generating a binomial random variable correlated with a normalrandom variable

2005-04-04 Thread Dimitris Rizopoulos
one idea is to consider that the underlying (for ease normally distributed) latent variables that produce the Bernoulli trials are correlated with your original normal random variable. I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public