Re: [R] cross product

2006-04-09 Thread Antonio, Fabio Di Narzo
2006/4/8, He, Yulei [EMAIL PROTECTED]:

 Hi, there.



 How do I calculate the cross-product in the form of
 \sum_{i=1}^{n}X_{i}^{t} \Sigma X_{i} using R code without using do loop?
 X_{i} is the covariate matrix for subject I, \Sigma is the covariance
 matrix.


If I don't miss something in the matrix algebra, maybe you want the
following:

 crossprod(crossprod(t(X),sigma),X)

where X is the 'n by d' matrix of covariates, and sigma the 'd by d' matrix
of assigned covariances.

Antonio, Fabio Di Narzo.

Thanks for your help.



 Yulei




 [[alternative HTML version deleted]]

 __
 R-help@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


[[alternative HTML version deleted]]

__
R-help@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


[R] cross product

2006-04-08 Thread He, Yulei
Hi, there.

 

How do I calculate the cross-product in the form of
\sum_{i=1}^{n}X_{i}^{t} \Sigma X_{i} using R code without using do loop?
X_{i} is the covariate matrix for subject I, \Sigma is the covariance
matrix.

 

Thanks for your help.

 

Yulei

 


[[alternative HTML version deleted]]

__
R-help@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