Learn R Programming

NonProbEst (version 0.2.4)

generic_jackknife_variance: Calculates Jackknife variance with reweighting for an arbitrary estimator

Description

Calculates the variance of a given estimator by Leave-One-Out Jackknife (Quenouille, 1956) with reweighting in each iteration.

Usage

generic_jackknife_variance(sample, estimator, N = NULL)

Arguments

sample

Data frame containing the non-probabilistic sample.

estimator

Function that, given a sample as a parameter, returns an estimation.

N

Integer indicating the population size. Optional.

Value

The resulting variance.

Details

The estimation of the variance requires a recalculation of the estimates in each iteration which might involve weighting adjustments, leading to an increase in computation time. It is expected that the estimated variance captures the weighting adjustments' variability and the estimator's variability.

References

Quenouille, M. H. (1956). Notes on bias in estimation. Biometrika, 43(3/4), 353-360.

Examples

Run this code
# NOT RUN {
covariates = c("education_primaria", "education_secundaria",
   "age", "sex", "language")
if (is.numeric(sampleNP$vote_gen))
   sampleNP$vote_gen = factor(sampleNP$vote_gen, c(0, 1), c('F', 'T'))
vote_gen_estimator = function(sample) {
   model_based(sample, population, covariates,
      "vote_gen", positive_label = 'T', algorithm = 'glmnet')
}
generic_jackknife_variance(sampleNP, vote_gen_estimator)
# }

Run the code above in your browser using DataLab