Description Usage Arguments References See Also Examples
The function makes the estimation of the best lineal unbiased predictor (EBLUP) based on the Fay Herriot model.
1 2 |
x |
|
yhat |
Name of the column containing the variable’s estimated values. |
Sd.yhat |
Name of the column of estimated standard deviation for |
xk |
vector of characters which contains the names of the covariantes. |
method |
Estimation method used by the function |
x.predic |
Observations on which the forecast will be made |
Fay, R.E. and Herriot, R.A. (1979). Estimation of income from small places: An application of James-Stein procedures to census data. Journal of the American Statistical Association 74, 269-277.
Marhuenda, Y., Morales, D. and Pardo, M.C. (2014). Information criteria for Fay-Herriot model selection. Computational Statistics and Data Analysis 70, 268-280
Rao, J.N.K. (2003). Small Area Estimation. Wiley, London.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # Reading data
data('etc2013')
# Add dummys
etc2013[["IND"]] <- ifelse(is.na(etc2013[["hat.prom"]]), 'NO','SI')
# Identify observations with missing data
etc2013[["IMP"]] <- apply(etc2013[,c('x1','x2','x3','x4')], 1,
function(x){ifelse(anyNA(x),'IMP','NO_IMP')})
table(etc2013[,c("IND","IMP")])
# Separate observations
sampling <- subset( etc2013,IND == 'SI' & IMP == 'NO_IMP')
# Variable prediction
predic <- subset(etc2013,!c(IND == 'SI' & IMP == 'NO_IMP'))
# Impute observations prediction
imp <- mice::mice(predic[,c('x1','x2','x3','x4')], method = 'norm.boot')
predic[,c('x1','x2','x3','x4')] <- complete(imp)
FH <- fitFH(x = sampling, yhat = "hat.prom", Sd.yhat = "hat.sd",
xk = c('x1','x2','x3','x4'), x.predic = predic)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.