Repository navigation
Fix every issue from the 0.2.0 review - #2
Merged
Merged
Conversation
Samples paired their rows with the frame by position and kept a live reference to the caller's frame, so sorting a sample, subsetting it, or editing a data.table frame in place after drawing changed standard errors without a word. draw(weights = TRUE) now adds a .row column and stores a copy of the frame and its inclusion probabilities, and every reader goes through drawn_state(), which refuses subsets and bound samples. A certainty design over a with-replacement rest is now refused for weights like any other with-replacement design, and the refusal gives the bias factor instead of a fixed 15%.
Estimation trusted the sample's columns and re-derived the design in the current session. A removed or edited .prob gave a total of 0 or NA, an edited .weight gave different totals in ht_total() and as_svydesign(), renaming or dropping a stratum or cluster column changed the degrees of freedom and the jackknife, and a spatial sample analysed under another sf_use_s2() setting got standard errors for a different region. drawn_state() now refuses a .prob that differs from the probabilities recorded at draw time, and a design that gives the frame other probabilities in this session. Strata, clusters and time stamps are read from the frame's copy of the sampled rows. ht_total() and ht_mean() refuse a y that is not finite and warn when .weight was edited or the sample is grouped with dplyr.
The jackknife and the local-mean estimator deleted or compared rows that are in every possible sample, so certainty units from size-based designs, strata taken whole and censuses added variance the design does not have. The jackknife now holds them fixed and counts only the other units in its finite population correction, which is 0 at a census, and the local-mean estimator runs over the rows below certainty. pps_pi() takes a share within 1e-9 of 1 with certainty at exactly 1. A certainty design whose rest drew no rows reports no variance instead of an exact total, weights are refused when rest can never draw a row, and errors from rest say which rows it was given.
design_df() counted every sampled unit, so the units a size-based design takes with certainty, strata and intervals taken whole, and such units in a certainty design's rest raised the degrees of freedom of variances they do not contribute to, and t intervals undercovered. Only units below certainty count now, and a sample with none has infinite degrees of freedom. as_svydesign() hands each group of certain units to survey as one primary sampling unit with an fpc of 1. That keeps them out of Brewer's approximation, which they inflated, and makes survey::degf() agree. A census goes over as ids = ~1 with fpc the number of rows, where the PPS mappings failed inside svydesign(), and an empty sample, or a certainty sample whose rest drew nothing, is refused. ht_total() gives an empty draw from a design of random size a total of 0 without a variance.
Grouping keys came from interaction(), whose cost grew with the product of the columns' levels, whose carriage-return separator let two strata merge, and whose text levels followed the session's collation. Lookups by name also failed on an empty-string key. Keys are now built from per-column codes, with factor levels kept and text sorted by byte, and every per-group lookup goes by position or match(). Stratified sizes and allocations are worked out in one place for the draw and both probability paths, and a text order_by is walked in byte order.
Cluster labels were compared as text in the cluster variance, the joint probabilities, the jackknife and the hand-off to survey, so two numbers that print alike made one cluster. Every path now uses codes from count_clusters(), and cluster selection finds the chosen rows in one pass. design_multistage() gives the at-least-once probability under replacement, zeroes the joint probabilities of a row with no cluster, refuses n below n_clusters or below what min_per_cluster needs, warns when the allocation leaves a selected cluster empty, and declines a variance from a single cluster. Argument choices are checked by check_choice(), whose message names the argument.
…means Every error inside an estimator used to read as a decline, so running out of memory sent the estimate to the jackknife with R's message as the reason. Refusals now raise a drawn_declined condition and nothing else is caught. A Hajek mean resting on one sampling unit, a domain clear of a lonely stratum, a df below 1 and a systematic sample of random size each get the variance or the refusal the design supports.
Whether a mean is a proportion is now read from the frame rather than from the values one sample drew, and a proportion of 0 or 1 gets a beta interval instead of a zero-width one. The design effect and the finite population corrections now count only the rows the design can reach, and estimates report the rows they cannot cover.
Sen-Yates-Grundy summed over every pair of sampled rows through n x n matrices, about 1.4 GB for a stratified sample of 4,000 rows and again for each by domain. For simple random, reservoir, spatial, stratified, temporal and equal-take multistage samples it equals the grouped simple random or two-stage formula, which is now computed directly in linear time and memory. The pairwise sum stays as the reference the tests compare against, behind a size guard of about 1 GB. joint_prob() refuses a matrix past about 1 GB and points to rows = s$.row. The group, cluster, multistage and systematic joints fill one block at a time instead of comparing every pair of codes with outer(), which held up to twelve times the result's size.
Each by domain ran the variance estimator from scratch, rebuilding the strata, clusters, systematic order and other frame-level pieces every time. A context made once per call now holds them, and designs whose variance is simple random sampling within groups get every domain from one rowsum() over group and domain. The new contrast argument weighs the by domains and runs the weighted sum of their linearised variables through one variance dispatch, so the covariance between domains is counted.
inclusion_prob(), joint_prob() and plot(type = "probability") skipped the checks draw() runs, so a design draw() refuses got probabilities above 1, a census of 1s or all zeros. Each design now has one setup helper that the draw and the probabilities both call, with the same message. Weights must be numeric on every path and every weights message names the column. Weights whose sum overflows are rescaled before the probabilities are worked out. joint_prob() pairs a repeated row with itself at its own probability and refuses fractional rows. The stored copy of the frame no longer shares its names vector with the caller's, which setnames() and column deletion edit in place. certainty_set() reports the rows a size-proportional design takes with certainty.
A stratum held at min_per_stratum or at its size now leaves the rest of n to be re-split by the rule over the other strata, as the cap already did, instead of the floor's rows being taken back one at a time from them.
Neyman allocation could only use the spread of a frame column, so pilot estimates of each stratum's standard deviation had to be planted in a made-up column, and there was no cost-optimal split. allocation_by now also takes the standard deviations per stratum, and cost the cost of one row, both matched to the strata by name. allocation_table() shows each stratum's rows, probability, spread and floor or cap status before drawing, from the same computation draw() uses.
A Date or offset-less string is now a clock time placed with
force_tz(roll_dst = c("boundary", "pre")), so a skipped or repeated
midnight gives the first instant of the day whatever the other rows
hold. Days and weeks step by calendar days and months and years are
added to the anchor, so intervals stay on local midnight across clock
changes and month ends no longer overflow. tz defaults to the zone of
a POSIXct column, and the zone and bounds are checked when the design
is built.
Under spherical geometry each edge of a longitude/latitude region follows a great circle, so a wide box takes in rows well outside the rectangle it looks like on a map. draw(), inclusion_prob() and joint_prob() now warn when an edge bows more than 0.1 degrees, and the antimeridian warning gives both readings of the edge. List regions are reprojected member by member and kept as separate parts, since s2 turned a union larger than a hemisphere into the rest of the globe. design_spread() and design_spatial() read a POINT geometry column, and design_spread() reads Date and date-time columns. The local-mean variance documentation gives measured ratios by sample size and sampling fraction.
design_spread() takes strata and allocation, splits n as design_stratified() does and runs the local pivotal method within each stratum. The variance adds up the strata's local mean variances, and the survey hand-off, allocation_table() and sample_summary() follow the strata. The help page advised spreading within strata with no way to do it. The pivotal walk set targets below 1e-9 to 0 before it began, so such a row was never drawn while inclusion_prob() reported its probability. Only rounding error in a pooled probability is settled now.
A list's length is known, so the reservoir now samples its positions as it does a data frame's rows, and a NULL element is an item rather than the end of the stream. Streams return items in arrival order, grow the reservoir as it fills and count past 2^31 items. The bootstrap draws every replicate's rows with the same random calls as before and subsets the data once. It gains a circular block method and matrix outputs of row numbers or counts, keeps duplicated column names, and uses the documented default block length for frames whose size is a perfect cube.
A connection is read 10,000 lines at a time, with Algorithm L's swaps placed within each block, so a seed gives the same sample as reading line by line. The line read past max_items goes back onto an open text-mode connection. batches = TRUE samples the rows of the data frames a generator returns.
An interval that does not divide the frame gives one of two sample sizes, and a fractional interval was refused, so a size such as 30 from 100 could not be asked for. With n, a start in (0, 1) walks a step of N / n rows and takes exactly n, each with probability n / N; pairs get the exact overlap of their stretches and the successive-difference variance drops the random-size term. The help pages now say that a fixed start is refused on every weighting path, and the refusal text is the same on each.
design_systematic(n_starts = m) draws m starts from 1:(m * interval) and walks each at that step, which keeps every probability at 1 / interval and gives the sample the exact random group variance on m - 1 degrees of freedom. design_stratified(within = design_systematic()) walks each allocated stratum from its own start at a step of N_h / n_h, with exact joint probabilities and the strata's successive-difference variances added up.
design_weighted() takes strata and allocation. Each stratum gets its share of n and is sampled by systematic PPS or Poisson on its own, and Deville's approximation is added up over the strata. design_multistage() takes size. Clusters are selected by systematic PPS over their size measures, then each gives the same take by simple random sampling. The variance is Deville's approximation over the estimated totals of the clusters below certainty plus the variance within each selected cluster divided by its probability, which is the exact two-stage estimator when every cluster has the same chance. A cluster taken with certainty is a stratum of its sampled rows for the variance, the degrees of freedom, the jackknife and the survey mapping.
design_cluster(balanced = TRUE) now has exact inclusion probabilities: the take averaged over the selections that include a cluster follows from the sorted cluster sizes. Balanced samples, and multistage samples whose take depends on the clusters selected, are weighted conditional on that selection, which draw() records with the sample. The estimate is unbiased given the selection and so over all of them, and its variance is the two-stage formula at each cluster's own take, which survey reproduces.
as_svydesign() refused a certainty design over a cluster, multistage, Poisson or replicated systematic rest, although survey expresses each one: the certainty rows become one more primary sampling unit beside the clusters, and a Poisson rest becomes poisson_sampling() over the whole sample. A multistage sample with one row from a cluster of several went over in two stages and survey stopped on a lonely PSU, where ht_total() falls back to the ultimate-cluster jackknife, which survey reproduces from the clusters alone. as_svydesign() also wrote over user columns named like its own design columns and silently dropped unnamed arguments in `...`; both are now refused.
survey::as.svrepdesign() stops on the PPS and Poisson designs that as_svydesign() hands over and gives a systematic sample a jackknife that ignores the walk, and calibrating a handed-over design needed population totals built by hand from the frame. replicate_weights() turns the package's jackknife into replicate weights for survey::svrepdesign(), with successive-difference replicates along the walk for systematic samples, so the standard error of a total is the one ht_total() gives. frame_totals() totals the stored frame's columns over the rows the design could reach, for survey::calibrate() and survey::postStratify().
deff() is now a generic that passes objects it has no method for to survey::deff(), called from the base environment so that survey's dispatch cannot find this package's default method and call it again. Temporal intervals are named by their start, so notes, survey strata and sample_summary() list them in time order.
A sample that went through a CSV file or a database lost its design and could not be estimated from, and every weighted sample carried a full copy of its frame into each file it was saved to. as_drawn() rebuilds a sample from its rows, the design and the frame, add_fieldwork() joins results by an id while keeping the design, and compact_sample() keeps only the frame columns the design reads. ht_mean(na_rm = TRUE) estimates the mean over the rows with y present as a domain of the whole sample, matching survey's na.rm. ht_total() still refuses a missing y and now says how low a total over the other rows would be and what to do instead.
design_simple() and design_spread() take `reserve`, and draw() lists that many reserves after the main sample, numbered by `.reserve` in the order they are used. Estimates refuse the list until use_reserves() replaces the units found unavailable with the first available reserves and weights the result over the frame without them.
ht_ratio() linearises the ratio of two totals and runs the design's own variance estimator on the residuals, by domain too, and ht_total(ratio =) scales it by the frame total of x. ht_total() and ht_mean() take several column names as y and keep the covariances between the estimates, found by polarisation since every variance estimator here is a quadratic form.
ht_quantile() estimates quantiles from the Hajek distribution function with survey's default step rule and Woodruff intervals, taking the variance of F(q) from the design's own estimator. A factor or character y in ht_total() and ht_mean() now gives a table with a row per level, and a single number as y is used for every row.
A mean or total now takes the finite population correction that matches an sd with divisor N - 1, so a margin that N - 1 rows meet is no longer planned as a census. Rounding no longer adds a row at response rates such as 0.7, n is a whole number of at least two, and deff accepts the pilot estimate itself, checked against target.
plot() checks palette, main, sub and the names in ... before it draws, and takes the old margins before setting them, so a par() call that fails partway no longer leaves them changed for the next plot. The helpers are called by name, ... replaces the panel's own limits and aspect, and design_spatial() and unscaled design_spread() maps default to one scale on both axes. grDevices joins Imports for col2rgb(); it ships with R.
A seed now draws the same sample under any session RNG kind, and a weighted sample records the seed, generator, version and time it was drawn with. Row names of the frame's own survive the draw. Simulations report each per-draw warning once with a count and announce long runs.
The successive-difference limits, interval coverage under skew, the jackknife's declines, Poisson certainty, draw order and the walk's start now say what the code does, with figures measured on this version. The estimation article checks designs with closed-form joint probabilities against their exact variance, so its table no longer shows Monte Carlo noise as bias.
A table of designs now takes each one through drawing, probabilities, estimation, survey and plotting, with each deliberate refusal checked by its message. Assertions that still passed against deliberately broken code now fail on it: spread scaling and inclusion, the local mean window, the negative variance branch, degrees of freedom for every design and the domain logit interval. The slow spread simulation runs on a smaller frame, tests repeated in the per-design files are gone, and fixtures and tests seed a stream that is restored afterwards instead of resetting the global one.
The guard scripts now read parsed Rd and parsed R code, so an unprocessed link past the arguments section, a link counted through a longer word, and a function defined with `=` or a backtick name are no longer missed. Both scripts check themselves on fixtures under tools/ before they run. One Ubuntu leg builds the PDF manual, fails on any NOTE and checks that README.md matches a fresh render of README.Rmd, ignoring the dated line of the sample summary.
A sample without recorded frame probabilities was matched only by its row count, so a with-replacement rest, an edited .prob or a change of sf_use_s2() went through. Its .prob is now compared with what the design gives each row, and its design gets the fields added since 0.2.0, whose absence let design$n match na_rm. The frame copy kept S4 vector columns without their S4 bit, which broke lubridate periods and the variance of a design ordered by one.
A multistage or balanced cluster sample that selects every cluster can take a small cluster whole. ht_total() leaves such a cluster out of the degrees of freedom and the jackknife holds it fixed, but as_svydesign() still handed it to survey as an ordinary cluster, so survey::degf() and, in the one-stage form, the standard error disagreed. It now goes in a stratum of its own, as other units taken with certainty do. The jackknife's notes now count the rows above a certainty threshold among the units held fixed, and give the advice to draw more units below certainty only when some were taken with certainty. The help pages, NEWS and cran-comments restate the systematic PPS agreement with survey from wider simulations.
A radix sort refuses non-ASCII text of unknown encoding, which is what read.csv() and readLines() return, so every grouped or ordered path stopped on accented text. Keys are now sorted and matched on a copy marked UTF-8 or bytes, with the bytes unchanged, so the order is the same in a UTF-8 session and in the C locale. check_choice() gives the default for NULL, as match.arg() did. A multistage sample from a frame of one cluster gets the variance of a simple random sample again, since stage one is a census there.
Rows taken with certainty now count as one sampling unit when deciding whether a Hajek mean's variance can be measured, as the jackknife and as_svydesign() treat them, so a domain sampled only through certain rows is declined unless its mean is exact. A frame row with a missing by value may belong to any domain, so a lonely stratum holding one is refused for all of them. A 0/1 column added after the draw is read as a proportion from its sampled values again, with a note, instead of switching to the symmetric interval without a word. The beta interval's effective size stays at or below the rows behind it after the df scaling, and an estimate of 0 or 1 gets that interval at 0 degrees of freedom. The constant-y tests use seeds where the old rounding noise shows.
The Sen-Yates-Grundy size guard declined a large sample for memory before asking whether the design has joint probabilities at all, so a design with none got the wrong reason. Message lists cut at five values ended in "..." followed by a full stop; they now end with a count of the rest.
The level between the floor and the cap was found from a running sum of slopes, which lost a small share added to a much larger one, so shares 1e20 apart took every stratum whole. It is now found by bisection with the slope and the held rows summed afresh. Given spreads and costs are scaled by powers of two before they are multiplied, which leaves every other split unchanged to the last bit. A standard deviation or cost for a stratum the frame lacks is ignored, since it changes nothing, and the rest of a certainty design that takes a stratum whole no longer fails on it. Without tz, a date-time bound paired with a clock time can run either way depending on the column's zone, so design_temporal() leaves their order to the point of use. A threshold taken from quantile() prints by its value again.
An edge from -180 to 180 lies on one meridian, so under s2 a box between the two encloses nothing; it warns again, while an edge along a pole does not. sample_summary() counts a spread or weighted stratum's frame rows as allocation_table() does, without the rows na_rm drops, and a count for a stratum na_rm empties is refused with that reason instead of as a stratum the data lacks.
When a 10,000-line block ended exactly at max_items, the line read past the cap came as a block of its own with none of its lines within the cap, and lines[-seq_len(0)] pushed nothing back, so caps of 10000, 20000 and so on lost that line. A systematic walk at a step under 2 rows, which design_systematic(n =) has when n is above half the rows walked, gives every pair of rows a positive joint probability. The docs and the variance note said no design-unbiased estimator ever existed.
With one row from each selected cluster, ht_total() falls back to the delete-a-cluster jackknife, but as_svydesign() still built two stages and survey stopped on the lonely second-stage unit. Such a sample now goes over as the clusters of that jackknife, and the standard errors agree. The sample_summary() docs said N_reachable is NA for any design without a closed form, where conditional samples get counts; the coverage floor quoted for stratified systematic PPS was rounded down; and the decline note counted zero certain clusters.
survey::as.svrepdesign() keeps the first-stage correction for balanced clusters, so its standard errors there are not those of the jackknife. Successive-difference replicates are now built a block of columns at a time, which cuts the peak memory to about twice the result.
With by = NULL, as_drawn() trusted `.row`, so a frame read back in another order gave the rows other rows' strata and clusters, and the standard error and degrees of freedom changed without a warning whenever the probabilities happened to agree. The columns the data shares with the frame are now compared on the rows `.row` names. A whole-cluster or fixed-take cluster sample short of a cluster's rows, and a sample without a row taken with certainty, are refused as subsets. vcov() of a by table gave 0 for covariances between domains that were never estimated. They are now NA, except between domains of a stratified sample that share no stratum, where 0 is exact. ht_mean(na_rm = TRUE) now names a domain left without a row and the y column in its note, a domain standard error lost to compact_sample() says so, add_fieldwork() words the clash with the design's own columns apart, and reserve with n = 0 is refused.
plan_size() let a survey estimate such as svymean(deff = TRUE) through as deff, because it is a number underneath, and inflated the plan by the estimated mean. Any object other than a result of ht_mean() or ht_total() is now refused by class, with a pointer to survey::deff(). An NA design effect from ht_mean(na_rm = TRUE) gets a message that says why. A stratified plan with min_per_stratum = 0 scanned up to half the frame or more before a small stratum got its first row. It is refused, and the search starts from the shares rounded up, which shortens the scan for plans with many strata. ht_quantile() refuses a logical y, documents the rounding tolerance of its quantile rule, and states that vcov() leaves the covariances between quantiles NA. A factor of the wrong length as y in ht_total() or ht_mean() is told that a factor is one of the accepted forms.
plot() refused main = quote(alpha), which is valid plotmath, and a function or name given to a checked argument warned from is.na(). The summary warning of a simulation named the first draw's cluster or start and gave a count that covered every draw with a warning of that kind, so it now says the count is of warnings like the one shown.
sf::st_segmentize() needs lwgeom, which sf only suggests, for longitude/latitude geometry, so the map view of a spatial design failed wherever lwgeom was missing. The outline's arcs are now placed on the sphere directly. The first two simulated draws carry one-off costs, and timing them made a two-second run announce minutes of work. The PPS coverage figures in ?ht_total now separate systematic from Poisson sampling, and the strict CI leg checks file dates against the runner's clock instead of a time service.
A sample saved by drawn 0.2.0 has no .row column and is matched to its frame rows by position. In a design that gives every row the same probability, sorting it left .prob as the design gives it, so the standard error changed with no error. The frame columns such a sample keeps now show the reorder, and the refusal points to as_drawn(). A systematic design saved by 0.2.0 has no n field, so design$n read na_rm and the design drew no rows. Every function that takes a design now fills in the fields added since. A design that stops on its stored frame under another sf_use_s2() setting is refused as a drifted design that names the setting, rather than with the design's own error about rows inside the region.
Domain labels were built with regular expressions that stop on text not valid in the session's encoding, so Latin-1 read in a UTF-8 session broke every by= estimate, sample_summary() and as_svydesign(). Cluster labels now go through the same byte keys as strata, so an unmarked and a UTF-8 copy of one label are one cluster in the C locale too. A cluster that stage one is certain to take is in every sample, so its rows are the units that vary. Hajek means, ratios and domain means inside such a cluster were declined as if the cluster were the only unit. Samples saved by drawn 0.2.0 work out their probabilities from the design again, so a census or a take-all stratum stays exact. A domain total whose sampled rows are all certain keeps its 0 with a note, and the HT domain mean refuses a frame whose by columns are missing.
A clock-time bound moves with the zone by less than a day, so a pair that mixes it with an instant and is a day or more out of order is out of order in every zone, and design_temporal() can refuse it when it is built.
model.frame() builds a frame of one row from a value that is not a column, so frame_totals(s, ~ n) returned a total over one row where the design could reach hundreds. A term now has to give one value for each reachable frame row. sample_summary() decided whether a size design took a group whole from the rows drawn, so a Poisson draw that held every row of a stratum by chance filed its certain rows differently. The design's probabilities decide it now.
as_drawn() compares the columns a file shares with the frame to catch a frame in another order. An infinite value never matched itself, text such as "F" that read.csv() and readr return as FALSE did not match the frame's text, and a local date-time that readr and fread() read back as UTC did not match the frame's zone, so valid samples were refused. Infinities now match the same infinity, logical values are compared with the text they were read from, and date-times in different zones match on the instant or the clock time, shown with their zones. Also name the y column in the contrast refusal, mark estimates from use_reserves() as taking unvisited units to be available, take a deff marked with I() as a number, refuse an all-missing quantile y as missing, and list the na_rm cause of an NA design effect in ?deff.
An empty expression() as main stopped the plot partway, and a longer one drew its parts over each other. A simulation now calls a warning's details varied only when they differ between draws; a draw that gives the same few messages every time is reported with how many it gave. The Hajek coverage sentence in ?ht_mean names the low variance estimate beside the ratio bias.
A census of clusters takes rows as the analytic estimator's units, but the jackknife still deletes whole clusters, so a domain mean, ratio, quantile or contrast inside one cluster got a standard error of about zero whenever the jackknife ran. Such domains are now declined with the cluster wording, and an explicit jackknife on a multistage sample says how far it inflates the variance between clusters. A sample saved by drawn 0.2.0 whose id column still matches its frame rows in order is no longer refused as reordered when a correction swaps two values of another column. as_drawn() reads lowercase t/f read back as logical, draw_design() upgrades a 0.2.0 design before dispatch, and the word list covers the terms added since it was made.
On macOS gc() has a memory-limit column, so the sixth column was not the peak in Mb, and without extended precision 1e-300 printed as 9.99999999999999e-301 in plan_size()'s error. The README check now ignores table padding and two-line error layout, which differ between pandoc and knitr versions.
On Apple silicon the literal 1e-300 itself parses as 9.99999999999999e-301, so plan_size()'s message is right to show that and the test now accepts either spelling. The format_bad() change that tried to reformat it could not help and is reverted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This branch works through the full review of drawn 0.2.0: 198 verified items covering wrong answers, crashes, documentation that claimed more than the code does, missing features, test gaps, and CI and packaging. Each bug fix has a regression test that fails on main, and NEWS.md lists every user-visible change under "drawn (development version)".
Wrong answers fixed
.rowcolumn and a copy of the frame. Sorting a sample no longer changes its standard error, and a subset,rbind()or a join that repeats rows is refused instead of estimated as if it had been drawn. Sorting one stratified sample byyused to cut its standard error from 3,015 to 1,332. A data.table edit to the frame after drawing no longer reaches samples already drawn..probagainst the probabilities recorded at draw time. A spatial sample analysed under anothersf::sf_use_s2()setting, or a sample analysed under another collation, is refused instead of getting a different standard error.as_svydesign(). The jackknife averaged 181 times the true variance on one frame, and 95% intervals covered 79%.design_certainty()over a with-replacementrestis refused for weights like any other with-replacement design. It gave a total a third too high in one example.deff()measured against unreachable rows, blank stratum or cluster values, daylight-saving time indesign_temporal()andNULLitems in reservoir lists all gave wrong results without a warning. Each is fixed.Behaviour changes to review
draw(weights = TRUE)adds a third column,.row, after.proband.weight.ht_total(),ht_mean(),as_svydesign()andsample_summary()refuse a subset or a bound sample. Code that subset a weighted sample before estimating needsby =instead.design_temporal(tz = NULL)lays out the window in the time column's own zone.New
design_stratified(), Neyman allocation from per-stratum standard deviations and costs,allocation_table(), sampling in proportion to size within strata and selecting first-stage clusters by size, weights for balanced cluster samples,design_spread(strata =), fixed-nand replicated systematic samples, the circular block bootstrap, reservoir batches, and reserve lists withuse_reserves().ht_ratio(),ht_quantile(), shares and counts for each level of a factory, domain contrasts, one-sided bounds, Korn and Graubard's interval for a proportion of 0 or 1, andcoef(),vcov(),confint(),as.data.frame()andtidy()methods.as_drawn(),add_fieldwork(),compact_sample(),replicate_weights(),frame_totals()andcertainty_set().plan_size(),deff_cluster(), and a plan passed asnto a design.Speed and memory
The analytic variance of simple random, reservoir, spatial, stratified, temporal and equal-take multistage samples comes from within-group variances, in time and memory that grow with the sample, where the Sen-Yates-Grundy matrices needed about 10 GB at n = 10,000.
byestimates handle every domain in one pass, andjoint_prob()refuses a matrix over about 1 GB.Packaging and CI
Version 0.2.0.9000. lubridate needs 1.9.0 or later; data.table and generics join Suggests; the testthat floor is 3.1.7. CI adds R 4.1, the declared minimum, the doc guards are stricter, and the site deploy step commits with a plain message.
Checks
devtools::test(): 6,612 expectations, 0 failures, 0 skips.R CMD check --as-cran, offline: 0 errors. The warnings come from the build machine, which has no qpdf and no en_US locale.Known limits
use_reserves()assumes every unit nobody visited is available. If the frame holds more unavailable units than were found, totals are too high by about their share of the frame; the Hajek mean is not affected.?use_reservessays so.