Learn R Programming

vardpoor (version 0.8.4)

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 the last column is the total of the population in each stratum.
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 stratum. In the last column is the total of the population in each stratum.
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 numeric 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:

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)


## Not run: 
# # 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)
# ## End(Not run)

Run the code above in your browser using DataLab