Improve estimator variance and allocation formulas#32
Open
XavierCLL wants to merge 1 commit into
Open
Conversation
Member
Author
Note: the STR change affects sample allocation only. The Post-Stratified-design change affects standard error, confidence intervals, coefficient of variation, and uncertainty for post-stratified simple/systematic estimators. |
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.
Summary
This PR fixes two estimator-calculation issues found while reviewing the AcATaMa equation table against the implementation and cited estimator formulas.
1. Post-stratified area variance
The simple/systematic post-stratified estimator previously built the variance component with only the contribution from samples belonging to a reference class:
For a binary class indicator inside a post-stratum, the sample variance must include both successes and failures. Algebraically:
where
p_hj = n_hj / n_h+.This PR usea a shared
post_stratified_variance_tablehelper with:This avoids underestimating post-stratified standard errors and confidence intervals, especially when
p_hjis high.2. Stratified sample allocation
The stratified sample-size helper already computed total sample size using the weighted stratum standard deviations:
However, per-stratum allocation used only mapped area proportions:
This meant the conjectured user accuracy
U_iaffected total sample size but not the relative allocation among strata. This PR updates allocation to:so per-stratum sample counts now use both mapped area proportion and expected stratum variability.
Files changed
AcATaMa/gui/accuracy_assessment_results.pyAcATaMa/utils/sampling_utils.pyW_i S_irather thanW_ialone.Verification
No test suite was run, per request.
Performed only non-test verification:
python -m py_compileon both changed modules.S_idiffers across strata, as expected.Notes
Stratified sampling fixtures may also change when area-based allocation is regenerated, because per-stratum counts now include
S_iin the allocation weights.