Skip to content

Commit

Permalink
Merge pull request #4 from bschneidr/sample-based-calibration
Browse files Browse the repository at this point in the history
Sample based calibration (for Issue #3)
  • Loading branch information
bschneidr authored May 12, 2022
2 parents 3f91ac1 + a520468 commit 7cddf73
Show file tree
Hide file tree
Showing 25 changed files with 2,636 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
^codecov\.yml$
^cran-comments\.md$
^CRAN-SUBMISSION$
^doc$
^Meta$
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@
.RData
.Ruserdata
*.Rproj
inst/doc
/doc/
/Meta/
census-api-key
successive-differences-replication.R
14 changes: 11 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ Description: Provides tools for creating and working with survey replicate weigh
extending functionality of the 'survey' package from Lumley (2004) <doi:10.18637/jss.v009.i08>.
Methods are provided for applying nonresponse adjustments to
both full-sample and replicate weights as suggested by
Rust and Rao (1996) <doi:10.1177/096228029600500305> in order to account for
the impact of these adjustments on sampling variances.
Rust and Rao (1996) <doi:10.1177/096228029600500305>.
Implements methods for sample-based calibration described by Opsomer and Erciulescu (2021)
<http://www.statcan.gc.ca/pub/12-001-x/2021002/article/00006-eng.htm>.
Diagnostic functions are included to compare weights and weighted estimates
from different sets of replicate weights.
License: GPL (>= 3)
Expand All @@ -21,6 +22,13 @@ Imports:
survey (>= 4.1),
utils
Suggests:
knitr,
covr,
testthat (>= 3.0.0)
testthat (>= 3.0.0),
rmarkdown,
tidycensus,
dplyr
Config/testthat/edition: 3
Depends:
R (>= 2.10)
VignetteBuilder: knitr
8 changes: 8 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# Generated by roxygen2: do not edit by hand

S3method(redistribute_weights,svyrep.design)
export(calibrate_to_estimate)
export(calibrate_to_sample)
export(redistribute_weights)
export(stack_replicate_designs)
export(summarize_rep_weights)
export(svyby_repwts)
importFrom(stats,as.formula)
importFrom(stats,coef)
importFrom(stats,model.frame)
importFrom(stats,model.matrix)
importFrom(stats,na.pass)
importFrom(stats,setNames)
importFrom(stats,terms)
importFrom(stats,weights)
importFrom(utils,packageVersion)
30 changes: 30 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# svrep (development version)

* Added functions `calibrate_to_estimate()` and `calibrate_to_sample()`
for calibrating to estimated control totals with methods
that account for the sampling variance of the control totals.
For an overview of these functions, please see the new vignette
"Calibrating to Estimated Control Totals".

* The function `calibrate_to_estimate()` requires the user
to supply a vector of control totals and its variance-covariance matrix.
The function applies Fuller's proposed adjustments to the replicate weights,
in which control totals are varied across replicates by perturbing the control
totals using a spectral decomposition of the control totals'
variance-covariance matrix.

* The function `calibrate_to_sample()` requires the user to supply
a replicate design for the primary survey of interest as well as a replicate
design for the control survey used to estimate control totals for calibration.
The function applies Opsomer & Erciulescu's method of varying
the control totals across replicates of the primary survey by matching each
primary survey replicate to a replicate from the control survey.

* Added an example dataset, `lou_vax_survey`, which is a simulated survey
measuring Covid-19 vaccination status and a handful of demographic variables,
based on a simple random sample of 1,000 residents of Louisville, Kentucky
with an approximately 50% response rate.
* An accompanying dataset `lou_pums_microdata` provides person-level microdata
from the American Community Survey (ACS) 2015-2019 public-use microdata sample
(PUMS) data for Louisville, KY. The dataset `lou_pums_microdata` includes
replicate weights to use for variance estimation and can be used to generate
control totals for `lou_vax_survey`.

# svrep 0.1.0

* Initial release of the package.
Loading

0 comments on commit 7cddf73

Please sign in to comment.