Learn R Programming

vardpoor (version 0.6.2)

vardom_othstr: Variance estimation for sample surveys in domain by the two stratification

Description

Computes the variance estimation for sample surveys in domain by the two stratification.

Usage

vardom_othstr(Y, H, H2, PSU, w_final, id=NULL,
       Dom = NULL, period=NULL, N_h = NULL,
       N_h2, Z = NULL,
       X = NULL, g = NULL, q = NULL, dataset = NULL, 
       confidence = .95,  percentratio=1, 
       outp_lin=FALSE, outp_res=FALSE)

Arguments

Y
Variables of interest. Object convertible to data.table or variable names as character, column numbers.
H
The unit stratum variable. One dimensional object convertible to one-column data.table or variable name as character, column number.
H2
The unit new stratum variable. One dimensional object convertible to one-column data.table or variable name as character, column number.
PSU
Primary sampling unit variable. One dimensional object convertible to one-column data.table or variable name as character, column number.
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, linearization of the at-risk-of-poverty rate is done 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.
N_h
optional data object convertible to data.table. If period is supplied, the time period is at the beginning of the object and after time period in the object is stratum. If period is not supplied, the first column in the object is stratum. In
N_h2
optional data object convertible to data.table. If period is supplied, the time period is at the beginning of the object and after time period in the object is new stratum. If period is not supplied, the first column in the object is new stra
Z
optional variables of denominator for ratio estimation. Object convertible to data.table or variable names as character, column numbers.
X
Optional matrix of the auxiliary variables for the calibration estimator. Object convertible to data.table or variable names as character, column numbers.
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
Positive integer value. All linearized variables are multiplied with percentratio value, by default - 1.
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.

Value

  • A list with objects are returned by the function:
  • lin_outA data.table containing the linearized values of the ratio estimator with id and PSU.
  • res_outA data.table containing the estimated residuals of calibration with id and PSU.
  • s2gA data.table containing the s^2g value.
  • all_resultA data.table, which containing variables: 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, 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

References

Jean-Claude Deville (1999). Variance estimation for complex statistics and estimators: linearization and residual techniques. Survey Methodology, 25, 193-203, URL http://www5.statcan.gc.ca/bsolc/olc-cel/olc-cel?lang=eng&catno=12-001-X19990024882. M. Liberts. (2004) Non-response Analysis and Bias Estimation in a Survey on Transportation of Goods by Road.

See Also

domain, lin.ratio, residual_est, vardomh, var_srs, variance_est, variance_othstr

Examples

Run this code
data(eusilc)

# Example 1
eusilc1 <- eusilc[1:1000, ]
dataset <- data.table(IDd=1:nrow(eusilc1), eusilc1)
N_h2 <- dataset[, sum(rb050, na.rm = FALSE), keyby="db040"]

aa<-vardom_othstr(Y="eqIncome", H="db040",H2="db040", PSU="db030", w_final="rb050",
           id="rb030", Dom = "db040", period=NULL, N_h=NULL, N_h2=N_h2, Z = NULL,
           X=NULL, g=NULL, q=NULL, dataset=dataset,           
           confidence = .95, outp_lin=TRUE, outp_res=TRUE)


# Example 2
dataset <- data.table(IDd=1:nrow(eusilc), eusilc)
N_h2 <- dataset[, sum(rb050, na.rm = FALSE), keyby="db040"]

aa<-vardom_othstr(Y="eqIncome", H="db040",H2="db040", PSU="db030", w_final="rb050",
           id="rb030", Dom = "db040", period=NULL, N_h=NULL, N_h2=N_h2, Z = NULL,
           X = NULL, g = NULL, dataset = dataset,
           q = rep(1, if (is.null(dataset)) 
                       nrow(as.data.frame(H)) else nrow(dataset)),
           confidence = .95, outp_lin=TRUE, outp_res=TRUE)

Run the code above in your browser using DataLab