biasbound: Worst-Case Bias Bound due to Incomplete Balance

View source: R/functions.R

biasboundR Documentation

Worst-Case Bias Bound due to Incomplete Balance

Description

Calculate the upper bound on the bias induced by approximate balance with a given hilbertnorm. Approximate balance is conducted in kbal() and uses only the first numdims dimensions of the singular value decomposition of the kernel matrix to generate weights w which produce mean balance between control or sampled units and treated or population units. The following function calculates the worse-case bias induced by this approximate balancing with weights w and a given hilbertnorm.

Usage

biasbound(observed, target, svd.out, w, w.pop = NULL, hilbertnorm = 1)

Arguments

observed

a numeric vector of length equal to the total number of units where sampled/control units take a value of 1 and population/treated units take a value of 0.

target

a numeric vector of length equal to the total number of units where population/treated units take a value of 1 and sample/control units take a value of 0.

svd.out

the list object output from svd() performed on the kernel matrix. Requires a list object with left singular vectors in svd.out$u and singular values in svd.out$d

w

numeric vector containing the weight for every corresponding unit. Note that these weights should sum to the total number of units, not to one. They are divided by the number of control or sample and treated or population units internally.

w.pop

an optional vector input to specify population weights. Must be of length equal to the total number of units (rows in svd.out) with all sampled units receiving a weight of 1. The sum of the weights for population units must be either 1 or the number of population units.

hilbertnorm

numeric value of the hilbertnorm.

Value

biasbound

value of worst-case bias bound due to incomplete balance with inputted weights

Examples


#load and clean data a bit
data(lalonde)
xvars=c("age","black","educ","hisp","married","re74","re75","nodegr","u74","u75")

#need a kernel matrix to run SVD on and pass in so get that first with makeK
#running makeK with the sampled units as the bases
K = makeK(allx = lalonde[,xvars], useasbases = 1-lalonde$nsw)

#svd on this kernel
svd_pass = svd(K)  
#let's use the original weights of 1/number of sampled units, and 1/number of target units
#this is the default if we pass in w as all 1's
biasbound(observed=(1-lalonde$nsw),
          target=lalonde$nsw,
          svd.out = svd_pass,
          w = rep(1,nrow(lalonde)), hilbertnorm=1)
 

chadhazlett/KBAL documentation built on Jan. 3, 2024, 9:57 p.m.