R/EmpCM.R

Defines functions EmpCM

Documented in EmpCM

EmpCM <-
function(model) {
  x <- ranef(model)
  L = length(x)
  centered <- lapply(1:L, function(i) {
    x[[i]] - colMeans(x[[i]])
  })
  empirical_covariance_matrix = lapply(1:L, function(i) {
    crossprod(as.matrix(centered[[i]])) / nrow(centered[[i]])
  })
  empirical_covariance_matrix
}

Try the qape package in your browser

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

qape documentation built on Aug. 21, 2023, 5:07 p.m.