Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,11 @@

## Documentation and site

* References in the help pages and the articles give a DOI for every work
that has one, checked against Crossref. A citation whose year began a line
turned into a numbered list in the spatial sampling article and in this
changelog, as did a sentence ending "passes 1." in `?certainty_set`; each
reads as written now.
* `?ht_total` said the exact multistage estimator understates by about a
third with one row per cluster. It understates by `f1` times the
within-cluster component, where `f1` is the share of clusters selected, and
Expand Down Expand Up @@ -1587,11 +1592,12 @@ and names any approximation when it prints.
first-order probabilities and scales each row by its own `1 - pi`. It
equals `sampling::varest()` exactly and tracks the empirical variance at
0.98, where the previous jackknife ran at 0.89.
* **Systematic samples get the successive-difference approximation** (Wolter
2007) rather than no variance at all. On a frame sorted by something related
to `y` it stays near the truth where the simple random formula overstates
two- to thirtyfold. Its limits — a cycle matching the interval, or a trend
so smooth the random start is the only variation — are documented.
* **Systematic samples get the successive-difference approximation**
(Wolter 2007) rather than no variance at all. On a frame sorted by
something related to `y` it stays near the truth where the simple random
formula overstates two- to thirtyfold. Its limits — a cycle matching the
interval, or a trend so smooth the random start is the only variation — are
documented.

## New

Expand Down
3 changes: 2 additions & 1 deletion R/design-bootstrap.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@
#'
#' @references
#' Efron, B. (1979). Bootstrap methods: another look at the jackknife.
#' *Annals of Statistics*, 7, 1–26.
#' *Annals of Statistics*, 7, 1–26. \doi{10.1214/aos/1176344552}
#'
#' Künsch, H. R. (1989). The jackknife and the bootstrap for general
#' stationary observations. *Annals of Statistics*, 17, 1217–1241.
#' \doi{10.1214/aos/1176347265}
#'
#' Politis, D. N. and Romano, J. P. (1992). A circular block-resampling
#' procedure for stationary data. In R. LePage and L. Billard (eds.),
Expand Down
4 changes: 2 additions & 2 deletions R/design-reservoir.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@
#'
#' @references
#' Vitter, J. S. (1985). Random sampling with a reservoir. *ACM Transactions
#' on Mathematical Software*, 11, 37–57.
#' on Mathematical Software*, 11, 37–57. \doi{10.1145/3147.3165}
#'
#' Li, K.-H. (1994). Reservoir-sampling algorithms of time complexity
#' O(n(1 + log(N/n))). *ACM Transactions on Mathematical Software*, 20,
#' 481–493.
#' 481–493. \doi{10.1145/198429.198435}
#'
#' @examples
#' nrow(draw(data.frame(id = 1:1000), design_reservoir(n = 10), seed = 1))
Expand Down
8 changes: 5 additions & 3 deletions R/design-spread.R
Original file line number Diff line number Diff line change
Expand Up @@ -168,20 +168,22 @@
#' @references
#' Deville, J.-C. and Tillé, Y. (1998). Unequal probability sampling without
#' replacement through a splitting method. *Biometrika*, 85, 89–101.
#' \doi{10.1093/biomet/85.1.89}
#'
#' Grafström, A., Lundström, N. L. P. and Schelin, L. (2012). Spatially
#' balanced sampling through the pivotal method. *Biometrics*, 68, 514–520.
#' \doi{10.1111/j.1541-0420.2011.01699.x}
#'
#' Grafström, A. and Schelin, L. (2014). How to select representative samples.
#' *Scandinavian Journal of Statistics*, 41, 277–290.
#' *Scandinavian Journal of Statistics*, 41, 277–290. \doi{10.1111/sjos.12016}
#'
#' Stevens, D. L. and Olsen, A. R. (2003). Variance estimation for spatially
#' balanced samples of environmental resources. *Environmetrics*, 14,
#' 593–610.
#' 593–610. \doi{10.1002/env.606}
#'
#' Stevens, D. L. and Olsen, A. R. (2004). Spatially balanced sampling of
#' natural resources. *Journal of the American Statistical Association*, 99,
#' 262–278.
#' 262–278. \doi{10.1198/016214504000000250}
#'
#' @examples
#' set.seed(1)
Expand Down
6 changes: 4 additions & 2 deletions R/design-stratified.R
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,14 @@
#'
#' @references
#' Neyman, J. (1934). On the two different aspects of the representative
#' method. *Journal of the Royal Statistical Society*, 97, 558–625.
#' method: the method of stratified sampling and the method of purposive
#' selection. *Journal of the Royal Statistical Society*, 97, 558–625.
#' \doi{10.2307/2342192}
#'
#' Cochran, W. G. (1977). *Sampling Techniques*, 3rd ed. Wiley.
#'
#' Wolter, K. M. (2007). *Introduction to Variance Estimation*, 2nd ed.
#' Springer.
#' Springer. \doi{10.1007/978-0-387-35099-8}
#'
#' @examples
#' df <- data.frame(id = 1:100, site = rep(letters[1:4], each = 25))
Expand Down
3 changes: 2 additions & 1 deletion R/design-systematic.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@
#' @references
#' Madow, W. G. and Madow, L. H. (1944). On the theory of systematic sampling,
#' I. *Annals of Mathematical Statistics*, 15, 1–24.
#' \doi{10.1214/aoms/1177731312}
#'
#' Wolter, K. M. (2007). *Introduction to Variance Estimation*, 2nd ed.
#' Springer.
#' Springer. \doi{10.1007/978-0-387-35099-8}
#'
#' @examples
#' df <- data.frame(id = 1:100, value = (1:100) / 10,
Expand Down
7 changes: 4 additions & 3 deletions R/design-weighted.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,17 @@
#'
#' @references
#' Madow, W. G. (1949). On the theory of systematic sampling, II. *Annals of
#' Mathematical Statistics*, 20, 333–354.
#' Mathematical Statistics*, 20, 333–354. \doi{10.1214/aoms/1177729988}
#'
#' Hartley, H. O. and Rao, J. N. K. (1962). Sampling with unequal
#' probabilities and without replacement. *Annals of Mathematical Statistics*,
#' 33, 350–374.
#' 33, 350–374. \doi{10.1214/aoms/1177704564}
#'
#' Brewer, K. R. W. and Hanif, M. (1983). *Sampling with Unequal
#' Probabilities*. Springer.
#' Probabilities*. Springer. \doi{10.1007/978-1-4684-9407-5}
#'
#' Tillé, Y. (2006). *Sampling Algorithms*. Springer.
#' \doi{10.1007/0-387-34240-0}
#'
#' @examples
#' df <- data.frame(id = 1:20, w = 1:20)
Expand Down
6 changes: 3 additions & 3 deletions R/estimate.R
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,14 @@
#' survey data. *Survey Methodology*, 24, 193–201.
#'
#' Korn, E. L. and Graubard, B. I. (1999). *Analysis of Health Surveys*.
#' Wiley.
#' Wiley. \doi{10.1002/9781118032619}
#'
#' Hájek, J. (1971). Comment on "An essay on the logical foundations of survey
#' sampling, part one" by D. Basu. In V. P. Godambe and D. A. Sprott (eds.),
#' *Foundations of Statistical Inference*, p. 236. Holt, Rinehart and Winston.
#'
#' Särndal, C.-E., Swensson, B. and Wretman, J. (1992). *Model Assisted Survey
#' Sampling*. Springer.
#' Sampling*. Springer. \doi{10.1007/978-1-4612-4378-6}
#'
#' Deville, J.-C. (1999). Variance estimation for complex statistics and
#' estimators: linearization and residual techniques. *Survey Methodology*,
Expand Down Expand Up @@ -608,7 +608,7 @@ sampled_proportion_note <- function(name = NULL) {
#' 25, 193–203.
#'
#' Särndal, C.-E., Swensson, B. and Wretman, J. (1992). *Model Assisted Survey
#' Sampling*. Springer.
#' Sampling*. Springer. \doi{10.1007/978-1-4612-4378-6}
#'
#' @examples
#' set.seed(1)
Expand Down
6 changes: 3 additions & 3 deletions R/inclusion.R
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ sampling_weight <- function(data, design, simulate = FALSE, R = 5000,
#'
#' A design whose inclusion probabilities are proportional to size gives a
#' row whose share of `n` reaches 1 a probability of exactly 1, and spreads
#' what is left of `n` over the other rows, repeating until no share passes
#' 1. `certainty_set()` says which rows of `data` those are, and where the
#' cut-off falls, before any sample is drawn.
#' what is left of `n` over the other rows, repeating until no share
#' passes 1. `certainty_set()` says which rows of `data` those are, and where
#' the cut-off falls, before any sample is drawn.
#'
#' @param data A data frame.
#' @param design [design_weighted()] with `method = "systematic"` or
Expand Down
1 change: 1 addition & 0 deletions R/plan.R
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@
#'
#' Valliant, R., Dever, J. A. and Kreuter, F. (2018). *Practical Tools for
#' Designing and Weighting Survey Samples*, 2nd ed. Springer.
#' \doi{10.1007/978-3-319-93632-1}
#'
#' @seealso [deff()] to measure the design effect of a past sample,
#' [deff_cluster()] for one from an intraclass correlation, [draw()] to
Expand Down
4 changes: 2 additions & 2 deletions R/quantile.R
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@
#' @references
#' Woodruff, R. S. (1952). Confidence intervals for medians and other
#' position measures. *Journal of the American Statistical Association*,
#' 47, 635–646.
#' 47, 635–646. \doi{10.1080/01621459.1952.10483443}
#'
#' Särndal, C.-E., Swensson, B. and Wretman, J. (1992). *Model Assisted Survey
#' Sampling*. Springer.
#' Sampling*. Springer. \doi{10.1007/978-1-4612-4378-6}
#'
#' @examples
#' set.seed(1)
Expand Down
16 changes: 8 additions & 8 deletions R/variance.R
Original file line number Diff line number Diff line change
Expand Up @@ -537,19 +537,19 @@
#' @references
#' Horvitz, D. G. and Thompson, D. J. (1952). A generalization of sampling
#' without replacement from a finite universe. *Journal of the American
#' Statistical Association*, 47, 663–685.
#' Statistical Association*, 47, 663–685. \doi{10.1080/01621459.1952.10483446}
#'
#' Sen, A. R. (1953). On the estimate of the variance in sampling with varying
#' probabilities. *Journal of the Indian Society of Agricultural Statistics*,
#' 5, 119–127.
#'
#' Yates, F. and Grundy, P. M. (1953). Selection without replacement from
#' within strata with probability proportional to size. *Journal of the Royal
#' Statistical Society B*, 15, 253–261.
#' Statistical Society B*, 15, 253–261. \doi{10.1111/j.2517-6161.1953.tb00140.x}
#'
#' Hartley, H. O. and Rao, J. N. K. (1962). Sampling with unequal
#' probabilities and without replacement. *Annals of Mathematical Statistics*,
#' 33, 350–374.
#' 33, 350–374. \doi{10.1214/aoms/1177704564}
#'
#' Deville, J.-C. (1999). Variance estimation for complex statistics and
#' estimators: linearization and residual techniques. *Survey Methodology*,
Expand All @@ -560,13 +560,13 @@
#' sample size. *Journal of Official Statistics*, 21, 543–570.
#'
#' Wolter, K. M. (2007). *Introduction to Variance Estimation*, 2nd ed.
#' Springer.
#' Springer. \doi{10.1007/978-0-387-35099-8}
#'
#' Korn, E. L. and Graubard, B. I. (1999). *Analysis of Health Surveys*.
#' Wiley.
#' Wiley. \doi{10.1002/9781118032619}
#'
#' Särndal, C.-E., Swensson, B. and Wretman, J. (1992). *Model Assisted Survey
#' Sampling*. Springer.
#' Sampling*. Springer. \doi{10.1007/978-1-4612-4378-6}
#'
#' @examples
#' set.seed(1)
Expand Down Expand Up @@ -1172,8 +1172,8 @@ overflow_note <- function() {
#'
#' With no unit below certainty the variance is exactly 0 and the result is
#' `Inf`. An empty sample, and a certainty design whose `rest` drew none of the
#' rows below the threshold, have no variance to build an interval on and get
#' 0. A systematic design with `n_starts` of 2 or more has the number of
#' rows below the threshold, have no variance to build an interval on and
#' get 0. A systematic design with `n_starts` of 2 or more has the number of
#' starts less one, the degrees of freedom of its random group variance.
#'
#' `as_svydesign()` hands each group of certain units to `survey` as one
Expand Down
8 changes: 4 additions & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ library(drawn)
population it came from.**

Pulling rows out of a data frame is easy. The hard part is what comes next:
someone asks what the total was across all 40,000 invoices, and you examined
200. Answering honestly needs to know how likely each examined row was to be
picked, and that number lives in the *design*, not in the sample. `drawn` keeps
the design around, so a sample can answer for itself:
someone asks what the total was across all 40,000 invoices, and you
examined 200. Answering honestly needs to know how likely each examined row
was to be picked, and that number lives in the *design*, not in the sample.
`drawn` keeps the design around, so a sample can answer for itself:

```{r setup-frame}
set.seed(42)
Expand Down
1 change: 1 addition & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ CMD
CRS
CRSs
Clopper
Crossref
Dever
Deville
Deville's
Expand Down
8 changes: 3 additions & 5 deletions man/certainty_set.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/design_bootstrap.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/design_reservoir.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions man/design_spread.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions man/design_stratified.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/design_systematic.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions man/design_weighted.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading