R/get_weights_from_mm.R

Defines functions get_weights_from_mm

get_weights_from_mm <- function(match.matrix, treat) {

  if (!is.integer(match.matrix)) match.matrix <- charmm2nummm(match.matrix, treat)

  weights <- weights_matrixC(match.matrix, treat)

  if (sum(weights) == 0)
    .err("No units were matched")
  if (sum(weights[treat == 1]) == 0)
    .err("No treated units were matched")
  if (sum(weights[treat == 0]) == 0)
    .err("No control units were matched")

  setNames(weights, names(treat))
}

Try the MatchIt package in your browser

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

MatchIt documentation built on Oct. 13, 2023, 9:08 a.m.