Poststratification adjusts the sampling and replicate weights so that
the joint distribution of a set of poststratifying variables matches
the known population joint distribution. Use rake
when
the full joint distribution is not available.
1 2 3 4 5  postStratify(design, strata, population, partial = FALSE, ...)
## S3 method for class 'svyrep.design'
postStratify(design, strata, population, partial = FALSE, compress=NULL,...)
## S3 method for class 'survey.design'
postStratify(design, strata, population, partial = FALSE, ...)

design 
A survey design with replicate weights 
strata 
A formula or data frame of poststratifying variables, which must not contain missing values. 
population 
A 
partial 
if 
compress 
Attempt to compress the replicate weight matrix? When

... 
arguments for future expansion 
The population
totals can be specified as a table with the
strata variables in the margins, or as a data frame where one column
lists frequencies and the other columns list the unique combinations
of strata variables (the format produced by as.data.frame
acting on a table
object). A table must have named dimnames
to indicate the variable names.
Compressing the replicate weights will take time and may even increase memory use if there is actually little redundancy in the weight matrix (in particular if the poststratification variables have many values and cut across PSUs).
If a svydesign
object is to be converted to a replication
design the poststratification should be performed after conversion.
The variance estimate for replication designs follows the same
procedure as Valliant (1993) described for estimating totals. Rao et
al (2002) describe this procedure for estimating functions (and also
the GREG or gcalibration procedure, see calibrate
)
A new survey design object.
If the sampling weights are already poststratified there will be no
change in point estimates after postStratify
but the standard
error estimates will decrease to correctly reflect the poststratification.
Valliant R (1993) Poststratification and conditional variance estimation. JASA 88: 8996
Rao JNK, Yung W, Hidiroglou MA (2002) Estimating equations for the analysis of survey data using poststratification information. Sankhya 64 Series A Part 2, 364378.
rake
, calibrate
for other things to do
with auxiliary information
compressWeights
for information on compressing weights
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23  data(api)
dclus1<svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)
rclus1<as.svrepdesign(dclus1)
svymean(~api00, rclus1)
svytotal(~enroll, rclus1)
# poststratify on school type
pop.types < data.frame(stype=c("E","H","M"), Freq=c(4421,755,1018))
#or: pop.types < xtabs(~stype, data=apipop)
#or: pop.types < table(stype=apipop$stype)
rclus1p<postStratify(rclus1, ~stype, pop.types)
summary(rclus1p)
svymean(~api00, rclus1p)
svytotal(~enroll, rclus1p)
## and for svydesign objects
dclus1p<postStratify(dclus1, ~stype, pop.types)
summary(dclus1p)
svymean(~api00, dclus1p)
svytotal(~enroll, dclus1p)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.