ebBHF: EB estimators of an indicator with non-sample values of...

Description Usage Arguments Details Value References See Also Examples

View source: R/ebBHF.R

Description

Fits by REML method the unit level model of Battese, Harter and Fuller (1988) to a transformation of the specified dependent variable by a Box-Cox family or power family and obtains Monte Carlo approximations of EB estimators of the specified small area indicators, when the values of auxiliary variables for out-of-sample units are available.

Usage

1
2
ebBHF(formula, dom, selectdom, Xnonsample, MC = 100, data,
      transform = "BoxCox", lambda = 0, constant = 0, indicator)

Arguments

formula

an object of class formula (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under Details.

dom

n*1 vector or factor (same size as y in formula) with domain codes.

selectdom

I*1 optional vector or factor with the domain codes for which we want to estimate the indicators. It must be a subset of the domain codes in dom. If this parameter is not included, the unique domain codes included in dom are considered.

Xnonsample

matrix or data frame containing in the first column the domain codes and in the rest of columns the values of each of p auxiliary variables for the out-of-sample units in each selected domain. The domains considered in Xnonsample must contain at least those specified in selectdom.

MC

number of Monte Carlo replicates for the empirical approximation of the EB estimator. Default value is MC=100.

data

optional data frame containing the variables named in formula and dom. By default the variables are taken from the environment from which ebBHF is called.

transform

type of transformation for the dependent variable to be chosen between the "BoxCox" and "power" families so that the dependent variable in formula follows approximately a Normal distribution. Default value is "BoxCox".

lambda

value for the parameter of the family of transformations specified in transform. Default value is 0, which gives the log transformation for the two possible families.

constant

constant added to the dependent variable before doing the transformation, to achieve a distribution close to Normal. Default value is 0.

indicator

function of the (untransformed) variable on the left hand side of formula that we want to estimate in each domain.

Details

This function uses random number generation. To fix the seed, use set.seed.

A typical model has the form response ~ terms where response is the (numeric) response vector and terms is a series of terms which specifies a linear predictor for response. A terms specification of the form first + second indicates all the terms in first together with all the terms in second with duplicates removed.

A formula has an implied intercept term. To remove this use either y ~ x - 1 or y ~ 0 + x. See formula for more details of allowed formulae.

Value

The function returns a list with the following objects:

eb

data frame with number of rows equal to number of selected domains, containing in its columns the domain codes (domain), the EB estimators of indicator (eb) and the sample sizes (sampsize). For domains with zero sample size, the EB estimators are based on the synthetic regression. For domains in selectdom not included in Xnonsample the EB estimators are NA.

fit

a list containing the following objects:

  • summary: summary of the unit level model fitting.

  • fixed: vector with the estimated values of the fixed regression coefficient.

  • random: vector with the predicted random effects.

  • errorvar: estimated model error variance.

  • refvar: estimated random effects variance.

  • loglike: log-likelihood.

  • residuals: vector with raw residuals from the model fit.

Cases with NA values in formula or dom are ignored.

References

- Molina, I. and Rao, J.N.K. (2010). Small Area Estimation of Poverty Indicators. The Canadian Journal of Statistics 38, 369-385.

See Also

pbmseebBHF

Examples

 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
32
33
34
35
data(incomedata)         # Load data set
attach(incomedata)

# Construct design matrix for sample elements
Xs <- cbind(age2, age3, age4, age5, nat1, educ1, educ3, labor1, labor2)

# Select the domains to compute EB estimators. 
data(Xoutsamp)
domains <- unique(Xoutsamp[,"domain"])

# Poverty gap indicator
povertyline <- 0.6*median(income)
povertyline                         # 6477.484
povgap <- function(y)     
{
   z <- 6477.484
   result <- mean((y<z) * (z-y) / z) 
   return (result)
}

# Compute EB predictors of poverty gap. The value constant=3600 is selected
# to achieve approximately symmetric residuals.
set.seed(123)
result <- ebBHF(income ~ Xs, dom=prov, selectdom=domains,
                Xnonsample=Xoutsamp, MC=10, constant=3600, indicator=povgap)
result$eb
result$fit$summary
result$fit$fixed
result$fit$random[,1]
result$fit$errorvar
result$fit$refvar
result$fit$loglike
result$fit$residuals[1:10]

detach(incomedata)

Example output

Loading required package: nlme
Loading required package: MASS
[1] 6477.484
  domain         eb sampsize
1     42 0.07319876       20
2      5 0.04268935       58
3     34 0.06708650       72
4     44 0.09094977       72
5     40 0.08937263       58
Linear mixed-effects model fit by REML
 Data: NULL 
       AIC      BIC    logLik
  18625.21 18718.23 -9300.604

Random effects:
 Formula: ~1 | as.factor(dom)
        (Intercept)  Residual
StdDev:  0.09547609 0.4131308

Fixed effects: ys ~ -1 + Xs 
                  Value   Std.Error    DF  t-value p-value
Xs(Intercept)  9.537283 0.022006686 17138 433.3812  0.0000
XsXsage2      -0.027813 0.013023247 17138  -2.1357  0.0327
XsXsage3      -0.027413 0.011916475 17138  -2.3004  0.0214
XsXsage4       0.074673 0.012984083 17138   5.7511  0.0000
XsXsage5       0.043535 0.013334832 17138   3.2647  0.0011
XsXsnat1      -0.028042 0.016019267 17138  -1.7505  0.0800
XsXseduc1     -0.159866 0.009077064 17138 -17.6121  0.0000
XsXseduc3      0.283830 0.010504488 17138  27.0199  0.0000
XsXslabor1     0.163679 0.008814327 17138  18.5697  0.0000
XsXslabor2    -0.056200 0.017678722 17138  -3.1790  0.0015
 Correlation: 
           Xs(In) XsXsg2 XsXsg3 XsXsg4 XsXsg5 XsXsn1 XsXsd1 XsXsd3 XsXsl1
XsXsage2   -0.216                                                        
XsXsage3   -0.237  0.585                                                 
XsXsage4   -0.214  0.505  0.689                                          
XsXsage5   -0.220  0.420  0.531  0.601                                   
XsXsnat1   -0.701  0.000  0.001 -0.006  0.007                            
XsXseduc1   0.004 -0.109 -0.237 -0.419 -0.563 -0.009                     
XsXseduc3   0.000 -0.060 -0.172 -0.163 -0.189  0.005  0.273              
XsXslabor1 -0.005 -0.270 -0.553 -0.345 -0.044  0.007  0.073 -0.108       
XsXslabor2  0.002 -0.192 -0.243 -0.141 -0.007 -0.002  0.004 -0.016  0.301

Standardized Within-Group Residuals:
        Min          Q1         Med          Q3         Max 
-4.19680268 -0.66047072  0.02061041  0.68969672  3.66527538 

Number of Observations: 17199
Number of Groups: 52 
Xs(Intercept)      XsXsage2      XsXsage3      XsXsage4      XsXsage5 
   9.53728299   -0.02781316   -0.02741263    0.07467327    0.04353472 
     XsXsnat1     XsXseduc1     XsXseduc3    XsXslabor1    XsXslabor2 
  -0.02804178   -0.15986602    0.28383002    0.16367944   -0.05620021 
 [1] -0.162994066  0.083665452  0.006156282  0.010610612  0.112049178
 [6]  0.056958532  0.139209334 -0.116227817  0.066798606 -0.135110483
[11]  0.175414493 -0.055216733  0.057731658 -0.068177953 -0.041611949
[16]  0.016430469 -0.040071002 -0.111260569 -0.023848814 -0.042183811
[21]  0.147726646 -0.057688364 -0.048976752 -0.038383546  0.081658097
[26] -0.060433327 -0.119010498  0.007236526 -0.005073185  0.082382359
[31]  0.054022677 -0.068640077 -0.066290363 -0.021216914  0.126457049
[36]  0.137526791  0.068024820 -0.024693868 -0.176217294 -0.066863506
[41] -0.009339917  0.054431979 -0.213186263 -0.078954489  0.106059545
[46] -0.025871701  0.091385311 -0.040677584 -0.021735275  0.150201608
[51]  0.083439902  0.024378193
[1] 0.1706771
[1] 0.009115684
[1] -9300.604
 [1]  0.07560699 -0.23550942 -0.86505003 -0.86274684 -0.04229917 -1.10005074
 [7]  0.13955333 -0.54144964 -0.20247407 -0.53275775

sae documentation built on March 26, 2020, 7:52 p.m.