weight_x {SeqAlloc} | R Documentation |
Calculate weight matrix from matrix of covariates
Description
Calculate a vector of weights relating vector xrow with the rows of xmat, according to the weights in vector carwt. For each row in xmat, the positions of agreement with xrow are found. The weight for that row of xmat is then the sum of the elements of carwt corresponding to the matches.
Usage
weight_x(xrow, xmat, carwt)
Arguments
xrow |
vector used for matching |
xmat |
matrix of covariates |
carwt |
vector of weight for each match |
Value
Vector of weights relating vector xrow to the rows of xmat
Author(s)
Xiaoshu Zhu xiaoshuzhu@westat.com and Sharon Lohr
References
Lohr, S. and X. Zhu (2015). Randomized Sequential Individual Assignment in Social Experiments: Evaluating the Design Options Prospectively. Sociological Methods and Research. [Advance online publication: December 27, 2015] doi: 10.1177/0049124115621332.
Examples
xrow <- c(1,0,1,1)
xmat <- matrix(rbinom(60,1,.4),ncol=4)
carwt <- c(.6,.4,.2,.1)
weight_x(xrow, xmat, carwt)
[Package SeqAlloc version 1.0 Index]