Changelog
Source:NEWS.md
svyplan 0.6.0
Initial CRAN release.
Sample size determination
-
n_prop()— sample size for a proportion (Wald, Wilson, log-odds methods). -
n_mean()— sample size for a mean (moe and cv modes). -
n_cluster()— optimal multistage cluster allocation (2- and 3-stage, budget and cv modes). -
n_multi()— multi-indicator sample size for surveys with several precision targets. Supports simple (single-stage) and multistage modes, with automatic per-domain optimization andmin_nfloor.
Precision analysis
-
prec_prop()— sampling precision (se, moe, cv) for a proportion given a sample size. Inverse ofn_prop(). -
prec_mean()— sampling precision for a mean given a sample size. Inverse ofn_mean(). -
prec_cluster()— sampling precision (cv) for a multistage cluster allocation. Inverse ofn_cluster(). -
prec_multi()— per-indicator sampling precision for multi-indicator survey designs. Inverse ofn_multi().
All n_* and prec_* functions are S3 generics with bidirectional round-trip: passing a precision object to the corresponding n_* function recovers the sample size, and vice versa.
Power analysis
-
power_prop()— power analysis for two-sample proportion tests. Solves for sample size, power, or minimum detectable effect (MDE). Supports panel overlap for repeated surveys. MDE mode searches both directions (p2 > p1andp2 < p1) and returns the closest detectable alternative. -
power_mean()— power analysis for two-sample mean tests. Same solve modes and features aspower_prop().
Stratification
-
strata_bound()— optimal strata boundary determination for a continuous stratification variable. Four methods: Dalenius-Hodges cumulative root frequency ("cumrootf"), geometric progression ("geo"), Lavallee-Hidiroglou iterative ("lh"), and Kozak random search ("kozak"). Four allocation methods: proportional, Neyman, optimal (cost-weighted), and Bankier (1988) power allocation ("power") with parameterqcontrolling the national/subnational precision trade-off. Take-all (certainty) strata via thecertainargument. -
predict.svyplan_strata()— apply strata boundaries to new data, returning a factor.
Design components
-
varcomp()— variance component estimation from frame data via nested ANOVA (SRS and PPS). S3 generic with methods for formulas, numeric vectors, andsurvey::svydesignobjects. -
design_effect()— S3 generic for design effect estimation (Kish, Henry, Spencer, Chen-Rust decomposition, and cluster planning mode). -
effective_n()— S3 generic for effective sample size.
Common features
- All sample size, precision, and power functions accept
deff(design effect),N(finite population correction), andresp_rate(response rate adjustment). -
predict()methods for sensitivity analysis: evaluate any result at new parameter combinations. -
confint()methods forsvyplan_nandsvyplan_precobjects. - When the survey package is installed,
survey::SE()andsurvey::cv()methods are registered automatically.
S3 classes
-
svyplan_n— sample size results (with se, moe, cv fields). -
svyplan_cluster— multistage allocation results. -
svyplan_prec— precision results. -
svyplan_varcomp— variance component estimates. -
svyplan_strata— strata boundary results. -
svyplan_power— power analysis results.
All classes have print, format, and summary methods.
Input validation
-
n_multi()andprec_multi()now reject non-positiverel_var,k1, andk2values in multistage mode. -
prec_multi()multistage mode now validatesdelta1(anddelta2for 3-stage) presence, type, NA, and range. -
prec_cluster()now validates thatrel_varandkare positive and finite. -
varcomp()now rejects NA and empty outcome vectors. -
confint()methods forsvyplan_nandsvyplan_precnow validate thatlevelis in (0, 1). -
design_effect()CR method now rejects mismatched vector lengths fory,strvar, andclvar. - Weight validators (
design_effect(),effective_n()) now reject non-finite values (Inf,-Inf).
Display
-
svyplan_clustertotal sample size is now computed as the product of ceiled per-stage sizes inprint(),format(), andas.integer(), ensuring displayed totals are consistent with displayed stage sizes. -
print()andformat()forsvyplan_clusternow show the unrounded continuous optimum alongside the operational total (e.g.total n = 1190 (unrounded: 1159)). - New
as.double.svyplan_cluster()method returns the continuous total (x$total_n). Useas.integer()for the operational total (fieldwork) andas.double()for the continuous optimum (mathematical solution).