calc_sphered_resid <-
function(raw_residuals, Q){
  stopifnot(is.vector(raw_residuals), is.numeric(raw_residuals), is.numeric(Q) || is.list(Q))
  sphered_residuals <- as.vector(covprod(Q, raw_residuals))
  return(sphered_residuals)
}
