50% off: Unlimited data and AI learning.
State of Data and AI Literacy Report 2025

vardpoor (version 0.20.1)

variance_othstr: Variance estimation for sample surveys by the new stratification

Description

Computes s2g and the variance estimation by the new stratification.

Usage

variance_othstr(
  Y,
  H,
  H2,
  w_final,
  N_h = NULL,
  N_h2,
  period = NULL,
  dataset = NULL,
  checking = TRUE
)

Arguments

Y

Variables of interest. Object convertible to data.table or variable names as character, column numbers or logical vector with only one TRUE value (length of the vector has to be the same as the column count of dataset).

H

The unit stratum variable. One dimensional object convertible to one-column data.table or variable name as character, column number or logical vector with only one TRUE value (length of the vector has to be the same as the column count of dataset).

H2

The unit new stratum variable. One dimensional object convertible to one-column data.table or variable name as character, column number or logical vector with only one TRUE value (length of the vector has to be the same as the column count of dataset).

w_final

Weight variable. One dimensional object convertible to one-column data.table or variable name as character, column number or logical vector with only one TRUE value (length of the vector has to be the same as the column count of dataset).

N_h

optional; either a data.frame giving the first column - stratum, but the second column - the total of the population in each stratum.

N_h2

optional; either a data.frame giving the first column - new stratum, but the second column - the total of the population in each new stratum.

period

Optional variable for the survey periods. If supplied, the values for each period are computed independently. One dimensional object convertible to one-column data.table or variable name as character, column number or logical vector with only one TRUE value (length of the vector has to be the same as the column count of dataset).

dataset

Optional survey data object convertible to data.table.

checking

Optional variable if this variable is TRUE, then function checks data preparation errors, otherwise not checked. This variable by default is TRUE.

Value

A list with objects are returned by the function:

  • betas A numeric data.table containing the estimated coefficients of calibration.

  • s2g A data.table containing the s^2g value.

  • var_est A data.table containing the values of the variance estimation.

Details

It is possible to compute population size Mg from sampling frame. The standard deviation of g-th stratum is Sg2=1Mg1k=1Mg(ygkY¯g)2=1Mg1k=1Mgygk2MgMg1Y¯g2

k=1Mgygk2 and Y¯g2 have to be estimated to estimate Sg2. Estimate of k=1Mgygk2 is h=1HNhnhi=1nhygi2zhi, where

zhi={0,hiθg1,hiθg , θg is the index group of successfully surveyed units belonging to g-th stratum. #'Estimate of Y¯g2 is

Y¯^g2=(Y¯^g)2Var^(Y¯^)

Y¯^g=Y^gMg=1Mgh=1HNhnhi=1nhyhizhi

So the estimate of Sg2 is

sg2=1Mg1h=1HNhnhi=1nhyhi2zhi

MgMg1((1Mgh=1HNhnhi=1nhyhizhi)21Mg2h=1HNh2(1nh1Nh)1nh1i=1nh(yhizhi1nht=1nhyhtzht)2)

Two conditions have to realize to estimate Sg2:nh>1,g and θg0,g.

Variance of Y^ is Var(Y^)=g=1GMg2(1mg1Mg)Sg2

Estimate of Var^(Y^) is

Var^(Y^)=g=1GMg2(1mg1Mg)sg2

References

M. Liberts. (2004) Non-response Analysis and Bias Estimation in a Survey on Transportation of Goods by Road.

See Also

domain, lin.ratio, linarpr, linarpt, lingini, lingini2, lingpg, linpoormed, linqsr, linrmpg, residual_est, vardom, vardom_othstr, vardomh, varpoord

Examples

Run this code
# NOT RUN {
library("data.table")
Y <- data.table(matrix(runif(50) * 5, ncol = 5))
   
H <- data.table(H = as.integer(trunc(5 * runif(10))))
H2 <- data.table(H2 = as.integer(trunc(3 * runif(10))))
   
N_h <- data.table(matrix(0 : 4, 5, 1))
setnames(N_h, names(N_h), "H")
N_h[, sk:= 10]
   
N_h2 <- data.table(matrix(0 : 2, 3, 1))
setnames(N_h2, names(N_h2), "H2")
N_h2[, sk2:= 4]
   
w_final <- rep(2, 10)
   
vo <- variance_othstr(Y = Y, H = H, H2 = H2,
                      w_final = w_final,
                      N_h = N_h, N_h2 = N_h2,
                      period = NULL,
                      dataset = NULL)
vo

# }

Run the code above in your browser using DataLab