[R] Correlation

Robert Sherry rsherry8 at comcast.net
Wed Jul 16 23:37:24 CEST 2014


Please consider the following R Script:
        x = c(1,2,3)
        y = c(1,2,9)
        cor(x,y)
These three lines will produce, as I expected, the correlation between 
the variables x and y. However, R is going to assume that the 
probability that x = 1 is the same as the probability that x = 2. 
Suppose I know the probability that x = 1 is 0.5 and the probability 
that x = 2 (or x = 3 ) is 0.25. I believe that would effect the 
correlation between the variables x and y. How do I tell R about these 
probabilities?

I thank the group in advance for their responses to this post.

Bob



More information about the R-help mailing list