The unit stratum variable. One dimensional object convertible to one-column data.table or variable name as character, column number.

PSU

w_final

Weight variable. One dimensional object convertible to one-column data.table or variable name as character, column number.

id

Optional variable for unit ID codes. One dimensional object convertible to one-column data.table or variable name as character, column number.

Dom

Optional variables used to define population domains. If supplied, variables of interest are calculated for each domain. An object convertible to data.table or variable names as character vector, column numbers.

period

Optional variable for survey period. If supplied, residual estimation of calibration is done independently for each time period. One dimensional object convertible to one-column data.table.

PSU_sort

optional; if PSU_sort is defined, then variance is calculated for systematic sample.

N_h

Number of primary sampling units in population for each stratum (and period if period is not NULL). If N_h = NULL and fh_zero = FALSE (default), N_h is estimated from sample data as sum of weights (w_final) in each stratum (and period if period is not NULL).

Optional for single-stage sampling design as it will be estimated from sample data. Recommended for multi-stage sampling design as N_h can not be correctly estimated from the sample data in this case. If N_h is not used in case of multi-stage sampling design (for example, because this information is not available), it is advisable to set fh_zero = TRUE.

If periodisNULL. A two-column matrix with rows for each stratum. The first column should contain stratum code. The second column - the number of primary sampling units in the population of each stratum.

If periodis notNULL. A three-column matrix with rows for each intersection of strata and period. The first column should contain period. The second column should contain stratum code. The third column - the number of primary sampling units in the population of each stratum and period.

fh_zero

by default FALSE; fh is calculated as division of n_h and N_h in each strata, if true, fh value is zero in each strata.

PSU_level

by default TRUE; if PSU_level is true, in each strata fh is calculated as division of count of PSU in sample (n_h) and count of PSU in frame(N_h). if PSU_level is false, in each strata fh is calculated as division of count of units in sample (n_h) and count of units in frame(N_h), which calculated as sum of weights.

Z

X

Optional matrix of the auxiliary variables for the calibration estimator. Object convertible to data.table or variable names as character, column numbers.

ind_gr

Optional variable by which divided independently X matrix of the auxiliary variables for the calibration. One dimensional object convertible to one-column data.table or variable name as character, column number.

g

Optional variable of the g weights. One dimensional object convertible to one-column data.table or variable name as character, column number.

q

Variable of the positive values accounting for heteroscedasticity. One dimensional object convertible to one-column data.table or variable name as character, column number.

dataset

Optional survey data object convertible to data.table.

confidence

Optional positive value for confidence interval. This variable by default is 0.95.

percentratio

outp_lin

Logical value. If TRUE linearized values of the ratio estimator will be printed out.

outp_res

Logical value. If TRUE estimated residuals of calibration will be printed out.

Details

Calculate variance estimation in domains based on book of Hansen, Hurwitz and Madow.

Value

A list with objects is returned by the function:

lin_out

A data.table containing the linearized values of the ratio estimator with id and PSU.

res_out

A data.table containing the estimated residuals of calibration with id and PSU.

all_result

A data.table, which containing variables:
variable - names of variables of interest, Dom - optional variable of the population domains, period - optional variable of the survey periods, respondent_count - the count of respondents, pop_size - the estimated size of population, n_nonzero - the count of respondents, who answers are larger than zero, estim - the estimated value, var - the estimated variance, se - the estimated standard error, rse - the estimated relative standard error (coefficient of variation), cv - the estimated relative standard error (coefficient of variation) in percentage, absolute_margin_of_error - the estimated absolute margin of error, relative_margin_of_error - the estimated relative margin of error in percentage, CI_lower - the estimated confidence interval lower bound, CI_upper - the estimated confidence interval upper bound, confidence_level - the positive value for confidence interval, S2_y_HT - the estimated variance of the y variable in case of total or the estimated variance of the linearised variable in case of the ratio of two totals using non-calibrated weights, S2_y_ca - the estimated variance of the y variable in case of total or the estimated variance of the linearised variable in case of the ratio of two totals using calibrated weights, S2_res - the estimated variance of the regression residuals, var_srs_HT - the estimated variance of the HT estimator under SRS, var_cur_HT - the estimated variance of the HT estimator under current design, var_srs_ca - the estimated variance of the calibrated estimator under SRS, deff_sam - the estimated design effect of sample design, deff_est - the estimated design effect of estimator, deff - the overall estimated design effect of sample design and estimator, n_eff - the effective sample size.