The basic question is "If the correlation coefficient between CEO quality and firm success is 0.3, and two firms are otherwise very similar (i.e. the probability of one being more successful than the other is 0.5 given equally skilled CEOs), what is the probability that a firm will be more successful than the other given that they hire a better CEO?"

I created two sets of random normal variables with a correlation coefficient of 0.3. Then I wanted to simply count how often CEO quality is associated with firm success. In other words, I wanted to compare a bunch of "pairs of firms" and see how often the firm with the better CEO was more successful. To do so, I created two vectors of random index numbers, and then I ran a command to count how often firm

*> firm[j] & CEO*

*>CEO[j]. I added this to a count where the i values are less than the j values because the real question is "given that the CEO value is bigger".*

Here's the code:

CEO = rnorm(1000000)

y = rnorm(1000000)

Firm = .3*CEO + (sqrt(1-.3^2))*y

indices_i = sample.int(1000000,size=1000000,replace=TRUE)

indices_j = sample.int(1000000,size=1000000,replace=TRUE)

mean( CEO[indices_i] > CEO[indices_j] & Firm[indices_i] > Firm[indices_j])

+ mean( CEO[indices_i] < CEO[indices_j] & Firm[indices_i] < Firm[indices_j])

I think this is right because it results in a probability of 0.6, which is the right answer. But I have two questions: 1) Is this correct (I might have gotten lucky with the answer), and 2) is there a more efficient way to do this?

Thanks!Here's the code:

CEO = rnorm(1000000)

y = rnorm(1000000)

Firm = .3*CEO + (sqrt(1-.3^2))*y

indices_i = sample.int(1000000,size=1000000,replace=TRUE)

indices_j = sample.int(1000000,size=1000000,replace=TRUE)

mean( CEO[indices_i] > CEO[indices_j] & Firm[indices_i] > Firm[indices_j])

+ mean( CEO[indices_i] < CEO[indices_j] & Firm[indices_i] < Firm[indices_j])

I think this is right because it results in a probability of 0.6, which is the right answer. But I have two questions: 1) Is this correct (I might have gotten lucky with the answer), and 2) is there a more efficient way to do this?

Thanks!