adjwgt {spsurvey} | R Documentation |
Adjust survey design weights by categories
Description
Adjust initial survey design weights so that the
final weights sum to a desired frame size. Adjusted weights
proportionally scale the initial weights to sum to the desired frame size.
Separate adjustments are applied to each category specified in wgtcat
.
Usage
adjwgt(wgt, wgtcat = NULL, framesize, sites = NULL)
Arguments
wgt |
Vector of initial weights for each site. These equal the reciprocal of the site's inclusion probability. |
wgtcat |
Vector containing each site's weight adjustment
category name. The default is |
framesize |
Vector containing the known size of the frame
for each category name in |
sites |
Vector indicating site use; |
Value
Vector of adjusted weights, where the adjusted weight is set
to 0
for sites whose value in the sites argument was set to
FALSE
.
Author(s)
Tony Olsen olsen.tony@epa.gov
Examples
wgt <- runif(50)
wgtcat <- rep(c("A", "B"), c(30, 20))
framesize <- c(A = 15, B = 10)
sites <- rep(rep(c(TRUE, FALSE), c(9, 1)), 5)
adjwgt(wgt, wgtcat, framesize, sites)