R/hero.prepared_array.R

Defines functions hero.prepared_array

Documented in hero.prepared_array

#' @rdname hero
#' @export
hero.prepared_array = function(x, ...) {
  lambda = exp(x$loglambda)
  parts = lapply(seq_along(lambda), function(i) {
    x$Q[[i]] %*% x$U[[i]] %*% diag(1/(1 + lambda[i]*x$s[[i]]))
  })
  coeffs = rh.seq(parts, x$Ytilde)
  fitted = rh.seq(x$B, coeffs)
  out = list(fitted = fitted, coefficients = coeffs, x = x$x)
  class(out) = c("hero_array", "hero")
  return(out)
}

Try the hero package in your browser

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

hero documentation built on July 26, 2023, 5:11 p.m.