variance_othstr {vardpoor} | R Documentation |
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.
|
Details
It is possible to compute population size Mg
from sampling frame. The standard deviation of g
-th stratum is
Sg2=Mg−11k=1∑Mg(ygk−Yˉg)2=Mg−11k=1∑Mgygk2−Mg−1MgYˉg2
k=1∑Mgygk2
and Yˉg2
have to be estimated to estimate Sg2
. Estimate of k=1∑Mgygk2
is h=1∑HnhNhi=1∑nhygi2zhi
, where
zhi={0,1,hi∈/θghi∈θg
, θg
is the index group of successfully surveyed units belonging to g
-th stratum. #'Estimate of Yˉg2
is
Yˉ^g2=(Yˉ^g)2−Var^(Yˉ^)
Yˉ^g=MgY^g=Mg1h=1∑HnhNhi=1∑nhyhizhi
So the estimate of Sg2
is
sg2=Mg−11h=1∑HnhNhi=1∑nhyhi2zhi−
−Mg−1Mg((Mg1h=1∑HnhNhi=1∑nhyhizhi)2−Mg21h=1∑HNh2(nh1−Nh1)nh−11i=1∑nh(yhizhi−nh1t=1∑nhyhtzht)2)
Two conditions have to realize to estimate Sg2:nh>1,∀g
and θg=0,∀g.
Variance of Y^
is
Var(Y^)=g=1∑GMg2(mg1−Mg1)Sg2
Estimate of Var^(Y^)
is
Var^(Y^)=g=1∑GMg2(mg1−Mg1)sg2
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.
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
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
[Package
vardpoor version 0.20.1
Index]