confidence_interval: Confidence interval

Description Usage Arguments Value Examples

View source: R/NonProbEst.R

Description

Calculates the confidence interval for the estimator considered.

Usage

1
confidence_interval(estimation, std_dev, confidence = 0.95)

Arguments

estimation

A numeric value specifying the point estimation.

std_dev

A numeric value specifying the standard deviation of the point estimation.

confidence

A numeric value between 0 and 1 specifying the confidence level, taken as 1 - alpha (1 - Type I error). By default, its value is 0.95.

Value

A vector containing the lower and upper bounds.

Examples

1
2
3
4
5
6
7
8
9
covariates = c("education_primaria","education_secundaria",
"age", "sex")
pi = propensities(sampleNP, sampleP, covariates, algorithm = "glm", smooth = FALSE)
psa_weights = sc_weights(pi$convenience)
N = 50000
Y_est = total_estimation(sampleNP, psa_weights, estimated_vars = "vote_pens", N = N)
VY_est = fast_jackknife_variance(sampleNP, psa_weights,
   estimated_vars = "vote_pens") * N^2
confidence_interval(Y_est, sqrt(VY_est), confidence = 0.90)

Example output

Loading required package: lattice
Loading required package: ggplot2
lower.vote_pens upper.vote_pens 
       16974.82        19537.56 

NonProbEst documentation built on July 1, 2020, 6:08 p.m.