R/interpolate_mat.R

Defines functions interpolate_mat

interpolate_mat <- function(mat, lam_list, lambda, take_log = FALSE) {
  m <- length(lambda)
  if (take_log) mat <- log(mat)
  out <- mat[, lam_list$left, drop = FALSE] %*% diag(lam_list$frac, m, m) +
    mat[, lam_list$right, drop = FALSE] %*% diag(1 - lam_list$frac, m, m)
  if (take_log) out <- exp(out)
  drop(out)
}

Try the rtestim package in your browser

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

rtestim documentation built on Aug. 8, 2025, 6:21 p.m.