How this calculation works
Horvitz–Thompson estimation expands sampled values using their first-order inclusion probabilities. Joint inclusion probabilities provide the pairwise terms of a design-based variance estimator. Those probabilities must come from a valid sampling design; checking their numerical ranges cannot establish the entire design from one observed sample.
HT total=Σ_s y_i/pi_i; estimated variance=Σ_{i,jin s}[(pi_ij−pi_i pi_j)/pi_ij](y_i/pi_i)(y_j/pi_j).A worked example
For sampled values10and20, inclusion probabilities1/2and joint probability1/6between the two units, the estimated total is60. The diagonal variance contributions sum to1000and the two off-diagonal contributions sum to−800, leaving estimated variance200and SE√200≈14.1421.
Good to know
1–100 sampled values, first-order inclusion probabilities0<pi≤1 and a symmetric sampled-unit joint matrix with diagonal pi and positive off-diagonal entries satisfying necessary pairwise probability bounds. Compute HT total and the unbiased HT variance estimator; allow an explicitly labeled negative variance estimate with unavailable real SE instead of clamping. Supplied probabilities must come from a valid without-replacement design; pairwise checks do not certify full design realizability. No estimated inclusion probabilities or nonresponse adjustment.
Reference: CRAN sampling package: HTestimator and varHT (opens in a new tab) ↗
Estimate a total under a sampling design
An observed sample need not give every population unit the same chance of selection. Horvitz–Thompson estimation divides each sampled value by its known first-order inclusion probability before summing. The target is a finite-population total under the sampling design, rather than an unweighted sample mean or a regression coefficient with estimated propensity scores.
Design unbiasedness concerns repeated samples generated by the specified selection mechanism while population values remain fixed. It does not assert that a single realized sample exactly reproduces the population total. The inclusion probabilities must be appropriate for the actual sampling design; arbitrary survey weights or convenience-sample scores are not automatically valid substitutes for those probabilities.
Compare this with the Stratified survey mean calculator with finite population correction. Estimate a finite-population total under unequal first- and second-order sampling inclusion probabilities and report pairwise variance contributions. Existing stratified SRS means explicitly exclude unequal within-stratum probabilities and lack the joint-inclusion information needed here.
Supply first- and second-order probabilities
The first-order probability pi_iis the chance that unit iappears in a sample. The joint probability pi_ijis the chance that both units appear. Its diagonal equals pi_i. The supplied matrix must be symmetric and satisfy necessary pairwise probability bounds. Positive joint probabilities are required for the supported unbiased pairwise variance expression.
These probabilities refer to sampling without replacement, with units identified consistently across values and matrix rows. A sampled-unit submatrix does not describe every unsampled population unit or establish full realizability of a design. Necessary pairwise checks can detect obvious contradictions, but passing them is not a proof that a complete sampling mechanism with those probabilities exists.
Retain covariance contributions in the variance
The variance estimator combines expanded values with the difference between joint and product inclusion probabilities. Its diagonal terms reflect individual inclusion uncertainty, and its off-diagonal terms reflect dependence of selections. Omitting the off-diagonal contributions changes the design assumption and can substantially change the result, even when the total estimate itself remains unchanged.
Negative pairwise contributions are possible and often meaningful in fixed-size sampling, where selecting one unit can reduce the chance of selecting another. The complete unbiased variance estimate can also be negative for some designs and realized samples. The calculator must report that state explicitly and leave a real standard error unavailable instead of silently clamping the estimate to zero.
Calculate the two-unit realized sample
The default sampled values are ten and twenty, each with inclusion probability one half. Their expanded contributions are twenty and forty, summing to an estimated total of sixty. The diagonal joint probabilities are one half, and the off-diagonal joint probability is one sixth. Those numbers are consistent with a two-of-four simple random sample for the selected pair.
The diagonal variance terms are two times ten squared and two times twenty squared, giving two hundred plus eight hundred. The two ordered off-diagonal terms together give minus eight hundred. The resulting estimated variance is two hundred, so the standard error is the square root of two hundred, approximately14.1421. The estimate pertains to this realized sample, not an assumed exact population total.
Distinguish population variance from its estimate
The theoretical design variance sums appropriate terms over the entire finite population. This page starts with sampled values and uses joint-inclusion weighting to estimate that quantity from the realized sample. An input matrix containing only sampled units should not be interpreted as the complete population design covariance. Naming those two objects precisely prevents misleading validation comparisons.
For a known tiny population and an explicitly listed sampling design, enumerate every possible sample. The probability-weighted average of HT totals should equal the population total. The probability-weighted average of the unbiased variance estimates should equal the design variance of those totals. This is a stronger validation than comparing only one convenient sample with a familiar formula.
Check units and limiting cases
Multiplying every outcome by cshould multiply the total by cand its variance estimate by c squared. A census with all inclusion probabilities equal to one has no design sampling variance. Reordering values and both axes of the joint matrix consistently should not change the scalar result. These checks expose row-order, diagonal and scaling mistakes.
Simple random sampling without replacement provides another useful reduction when first- and second-order probabilities are known. Compare with the corresponding finite-population total variance formula using matching sample-variance conventions. Invalid diagonals, asymmetric matrices, zero joint probabilities and values outside pairwise probability bounds should be rejected with clear descriptions of the failed assumption.
Do not hide additional survey adjustments
Calibration, nonresponse adjustment and estimated inclusion probabilities require additional justification and often different variance procedures. This calculator does not infer those mechanisms from a list of weights. Likewise, stratified simple random sampling can be analyzed directly with stratum summaries, but that special design does not cover arbitrary unequal probabilities within strata.
Report the target population, value definition, first- and joint-inclusion probability sources, sampling-without-replacement convention and variance estimator. A real standard error is meaningful only when the variance estimate and design assumptions support it. The page does not automatically attach a normal confidence interval or imply that sampling uncertainty captures measurement error, coverage error or selection bias.
A few questions, answered
Are ordinary analysis weights enough?
No. The total uses genuine inclusion probabilities, and this variance estimator also needs their second-order joint probabilities under the actual design.
Why can covariance contributions be negative?
Without-replacement selection can create negative dependence between unit inclusions. Those terms are part of the stated design variance calculation.
What if estimated variance is negative?
It must remain explicitly reported rather than being clamped. A real square-root standard error is unavailable for that estimate.
Do pairwise checks prove a valid sampling design?
No. They are necessary consistency checks on the supplied submatrix, not a complete design-realizability certificate.