2006/4/8, He, Yulei <he@hcp.med.harvard.edu>:>
> 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]]