R/tiltbin.R

Defines functions tiltbin.modified

# The tilting function for binary treatment
tiltbin.modified <- function(weight = "overlap") {
  if (weight == "overlap") {
    return(function(x) {
      x * (1 - x)
    })
  } else if (weight == "IPW") {
    return(function(x, y) {
      y
    })
  } else if (weight == "matching") {
    return(function(x) {
      pmin(x, 1 - x)
    })
  } else if (weight == "entropy") {
    return(function(x) {
      -(x * log(x) + (1 - x) * log(1 - x))
    })
  } else if (weight == "treated") {
    return(function(x) {
      x
    })
  }
}

Try the RCTrep package in your browser

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

RCTrep documentation built on Nov. 2, 2023, 6:10 p.m.