Leeds, Mark (IED)
2007-Mar-01 22:01 UTC
[R] covariance question which has nothing to do with R
This is a covariance calculation question so nothing to do with R but maybe someone could help me anyway. Suppose, I have two random variables X and Y whose means are both known to be zero and I want to get an estimate of their covariance. I have n sample pairs (X1,Y1) (X2,Y2) . . . . . (Xn,Yn) , so that the covariance estimate is clearly 1/n *(sum from i = 1 to n of ( X_i*Y_i) ) But, suppose that it is know that the X_i are positively correlated with each other and that the Y_i are independent of each other. Then, does this change the formula for the covariance estimate at all ? Intuitively, I would think that, if the X_i's are positively correlated , then something should change because there is less info there than if they were independent but i'm not sure what should change and I couldn't find it in a book. I can assume that the correlation between the X_i's is rho if this makes things easier ? Thanks. References are appreciated also. -------------------------------------------------------- This is not an offer (or solicitation of an offer) to buy/se...{{dropped}}
toby909 at gmail.com
2007-May-25 20:41 UTC
[R] covariance question which has nothing to do with R
while my other program is running..... The reference I mentioned previously addresses exactly this. Snijders and Bosker's Multilevel Analysis book on page 31 and 33, section 3.6.2 and 363 discuss this. When you say that the Xs are correlated then you would need to say according to which structure they are correlated: (1,X1,Y1) (1,X2,Y2) (1,X3,Y3) . . . (1,X55,Y55) (2,X56,Y56) (2,X57,Y57) . . . (2,................... To pick some real world examples one row represents a person, or a stock. And the first column indicates to which organization or to which country that person/stock belongs to. Then Xs are correlated within the organization/country. You will have two covariances, one within-county and one between country covariance of stocks. This can be implemented in R manually providing method of moments estimates, or the gls function providing ML or REML estimates can be used for that. I am not a post doc, just a pre master :-) Toby Leeds, Mark (IED) wrote:> This is a covariance calculation question so nothing to do with R but > maybe someone could help me anyway. > > Suppose, I have two random variables X and Y whose means are both known > to be zero and I want to get an estimate of their covariance. > > I have n sample pairs > > (X1,Y1) > (X2,Y2) > . > . > . > . > . > (Xn,Yn) > > , so that the covariance estimate is clearly 1/n *(sum from i = 1 to n > of ( X_i*Y_i) ) > > But, suppose that it is know that the X_i are positively correlated with > each other and that the Y_i are independent > of each other. > > Then, does this change the formula for the covariance estimate at all ? > Intuitively, I would think that, if the X_i's are positively > correlated , then something should change because there is less info > there than if they were independent but i'm not sure what should change > and I couldn't find it in a book. > > I can assume that the correlation between the X_i's is rho if this makes > things easier ? Thanks. > > References are appreciated also. > -------------------------------------------------------- > > This is not an offer (or solicitation of an offer) to buy/se...{{dropped}} > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >