Learn R Programming

vardpoor (version 0.2.0.8.1)

residual_est: Residual estimation of calibration

Description

Computes the estimation residuals of calibration.

Usage

residual_est(Y, X, weight, q, period=NULL, ind_gr)

Arguments

Y
matrix of the variable of interest; its length is equal to n, the sample size.
X
matrix of the auxiliary variables; for the calibration estimator, this is the matrix of the sample calibration variables.
weight
vector of the weights; its length is equal to n, the sample size.
q
vector of positive values accounting for heteroscedasticity; its size is n, the sample size.
period
optional; either a data.frame, matrix, data.table with column names giving different periods, or (if datasetX is not NULL) character strings, integers or a logical vectors (length is the same as 'datasetX' column co
ind_gr
optional; either a vector, 1 column data.frame, matrix, data.table giving the variable by which divided independently auxiliary variables, or (if datasetX is not NULL) a character string, an integer or a logical vector

Value

  • A numeric data.frame containing the estimated residuals of calibration.

Details

The function implements the following estimator: $$e_k=Y_k-X_k^{'}B$$ where $$\hat{B} = \left(\sum_{s} weight_k q_k X_k X^{'}_{k} \right)^{-1} \left(\sum_{s} weight_k q_k X_k Y_k \right)$$.

References

Sixten Lundstrom and Carl-Erik Sarndal. Estimation in the presence of Nonresponse and Frame Imperfections. Statistics Sweden, 2001, p. 43-44.

See Also

domain, lin.ratio, linarpr, linarpt, lingini, lingini2, lingpg, linpoormed, linqsr, linrmpg, vardom, vardomh, varpoord, variance_est, variance_othstr

Examples

Run this code
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)

Run the code above in your browser using DataLab