Description Usage Arguments Value References See Also Examples
View source: R/vardom_othstr.R
Computes the variance estimation for sample surveys in domain by the two stratification.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
Y |
Variables of interest. Object convertible to |
H |
The unit stratum variable. One dimensional object convertible to one-column |
H2 |
The unit new stratum variable. One dimensional object convertible to one-column |
PSU |
Primary sampling unit variable. One dimensional object convertible to one-column |
w_final |
Weight variable. One dimensional object convertible to one-column |
id |
Optional variable for unit ID codes. One dimensional object convertible to one-column |
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 |
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 |
N_h |
optional data object convertible to |
N_h2 |
optional data object convertible to |
Z |
optional variables of denominator for ratio estimation. Object convertible to |
X |
Optional matrix of the auxiliary variables for the calibration estimator. Object convertible to |
ind_gr |
Optional variable by which divided independently X matrix of the auxiliary variables for the calibration. One dimensional object convertible to one-column |
g |
Optional variable of the g weights. One dimensional object convertible to one-column |
q |
Variable of the positive values accounting for heteroscedasticity. One dimensional object convertible to one-column |
dataset |
Optional survey data object convertible to |
confidence |
Optional positive value for confidence interval. This variable by default is 0.95. |
outp_lin |
Logical value. If |
outp_res |
Logical value. If |
percentratio |
Positive |
numeric value. All linearized variables are multiplied with percentratio value, by default - 1.
A list with objects are 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.
betas - a numeric data.table containing the estimated coefficients of calibration.
s2g - a data.table containing the s^2g value.
all_result - a 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,
confidence_level - the positive value for confidence interval,
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.
Jean-Claude Deville (1999). Variance estimation for complex statistics and estimators: linearization and residual techniques. Survey Methodology, 25, 193-203, URL https://www150.statcan.gc.ca/n1/pub/12-001-x/1999002/article/4882-eng.pdf.
M. Liberts. (2004) Non-response Analysis and Bias Estimation in a Survey on Transportation of Goods by Road.
domain,
lin.ratio,
residual_est,
vardomh,
var_srs,
variance_est,
variance_othstr
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | library("laeken")
library("data.table")
data("eusilc")
# Example 1
eusilc1 <- eusilc[1:1000, ]
dataset1 <- data.table(IDd = paste0("V", 1:nrow(eusilc1)), eusilc1)
dataset1[, db040_2 := get("db040")]
N_h2 <- dataset1[, sum(rb050, na.rm = FALSE), keyby = "db040_2"]
aa <- vardom_othstr(Y = "eqIncome", H = "db040", H2 = "db040_2",
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 = dataset1, confidence = .95,
outp_lin = TRUE, outp_res = TRUE)
## Not run:
# Example 2
dataset1 <- data.table(IDd = 1:nrow(eusilc), eusilc)
dataset1[, db040_2 := get("db040")]
N_h2 <- dataset1[, sum(rb050, na.rm = FALSE), keyby = "db040_2"]
aa <- vardom_othstr(Y = "eqIncome", H = "db040", H2 = "db040_2",
PSU = "db030", w_final = "rb050", id = "rb030",
Dom = "db040", period = NULL, N_h2 = N_h2,
Z = NULL, X = NULL, g = NULL, dataset = dataset1,
q = NULL, confidence = .95, outp_lin = TRUE,
outp_res = TRUE)
aa
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.