startcost: Initialize a Distance Matrix.

View source: R/startcost.R

startcostR Documentation

Initialize a Distance Matrix.

Description

Creates an distance matrix of zeros of dimensions compatible with the treatment indicator vector z.

Usage

startcost(z)

Arguments

z

A vector with z[i]=1 if individual i is treated or z[i]=0 if individual i is control. The rows of costmatrix refer to treated individuals and the columns refer to controls. Although not strictly required, it is best that z has names that are the same as the names of the data frame dat that will be used in matching.

Value

A matrix of zeros with sum(z) rows and sum(1-z) columns. If z has names, then they become the row and column names of this matrix.

Author(s)

Paul R. Rosenbaum

Examples

data(binge)
# Select two treated and three controls from binge
d<-binge[is.element(binge$SEQN,c(109315,109365,109266,109273,109290)),]
z<-1*(d$AlcGroup=="B")
names(z)<-d$SEQN
dist<-startcost(z)
dist
rm(z,dist,d)

iTOS documentation built on Sept. 11, 2024, 8:57 p.m.