Description Usage Arguments Details Value References See Also Examples
Computes the estimation residuals of calibration.
1 | residual_est(Y, X, weight, q, dataset = NULL, checking = TRUE)
|
Y |
Matrix of the variable of interest. |
X |
Matrix of the auxiliary variables for the calibration estimator. This is the matrix of the sample calibration variables. |
weight |
Weight variable. 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 |
checking |
Optional variable if this variable is TRUE, then function checks data preparation errors, otherwise not checked. This variable by default is TRUE. |
The function implements the following estimator:
e_k=Y_k-X_k^{'}B
where
\hat{B} = ≤ft(∑_{s} weight_k q_k X_k X^{'}_{k} \right)^{-1} ≤ft(∑_{s} weight_k q_k X_k Y_k \right)
.
A list with objects are returned by the function:
residuals
- a numeric data.table
containing the estimated residuals of calibration.
betas
- a numeric data.table
containing the estimated coefficients of calibration.
Sixten Lundstrom and Carl-Erik Sarndal. Estimation in the presence of Nonresponse and Frame Imperfections. Statistics Sweden, 2001, p. 43-44.
domain
, lin.ratio
, linarpr
,
linarpt
, lingini
, lingini2
,
lingpg
, linpoormed
, linqsr
,
linrmpg
, vardom
, vardomh
,
varpoord
, variance_est
, variance_othstr
1 2 3 4 5 6 7 8 9 10 11 12 13 | Y <- matrix(rchisq(10, 3), 10, 1)
X <- matrix(rchisq(20, 3), 10, 2)
w <- rep(2, 10)
q <- rep(1, 10)
residual_est(Y, X, w, q)
### Test2
Y <- matrix(rchisq(10, 3), 10, 1)
X <- matrix(c(rchisq(10, 2), rchisq(10, 2) + 10), 10, 2)
w <- rep(2, 10)
q <- rep(1, 10)
residual_est(Y, X, w, q)
as.matrix(lm(Y ~ X - 1, weights = w * q)$residuals)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.