R/pooled.cov.R

Defines functions pooled.cov

Documented in pooled.cov

#[export]
pooled.cov <- function(x, ina) {
  s <- crossprod(x)
  ni <- sqrt( tabulate(ina) )
  mi <- rowsum(x, ina)/ni
  k <- length( ni )
  denom <- dim(x)[1] - k 
  for (i in 1:k)  s <- s - tcrossprod(mi[i, ])
  s/denom
}

 

Try the Rfast package in your browser

Any scripts or data that you put into this service are public.

Rfast documentation built on Nov. 9, 2023, 5:06 p.m.