[R] R-help google group

Vincent Nijs v-nijs at kellogg.northwestern.edu
Mon Dec 3 22:21:15 CET 2007


I made a google group archive of current and future R-help posts at
http://groups.google.com/group/r-help-archive

If you are signed-up for the R-help mailing list with a gmail account you
can reply to posts through the google group pages. Note that this is not a
separate mailing-list, just a copy of the original. Only posts after
December 3rd 2007 will be available.

I assume there are no objections to this. In case I am wrong please let me
know.

Vincent

 

On 12/3/07 3:02 PM, "Rick DeShon" <deshon at msu.edu> wrote:

> Hi All.
> 
> I would like to compute a separate covariance matrix for a set of
> variables for each of the levels of a factor and then compute the
> average covariance matrix over the factor levels.  I can loop through
> this computation but I need to perform the calculation for a large
> number of levels and am looking for something more elegant.  To be
> concrete....
> 
> u    <- 3
> n    <- 10
> 
> x    <- rnorm((id*u))
> y    <- rnorm((id*u))
> z    <- rnorm((id*u))
> id   <- gl(u,n)
> 
> df   <- data.frame(id,x,y,z)
> df.s <- split(xxx,id)
> 
> lcov <- lapply(df.s,cov)
> lcov
> 
> What's an efficient way to compute the average covariance matrix over
> the list members in "lcov"?
> 
> Thanks in advance,
> 
> Rick DeShon
> 
> ______________________________________________
> R-help at r-project.org 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.
> 

--



More information about the R-help mailing list