eblupBHF: EBLUPs of domain means based on a nested error linear...

Description Usage Arguments Details Value References See Also Examples

View source: R/eblupBHF.R

Description

This function calculates, for selected domains, EBLUPs of domain means based on the nested error linear regression model of Battese, Harter and Fuller (1988).

Usage

1
eblupBHF(formula, dom, selectdom, meanxpop, popnsize, method = "REML", data)

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 means. It must be a subset of the domain codes in dom. If this parameter is not included all the domain codes included in dom are considered.

meanxpop

D*(p+1) data frame with domain codes in the first column. Each remaining column contains the population means of each of the p auxiliary variables for the D domains. The domains considered in meanxpop must contain those specified in selectdom (D>=I).

popnsize

D*2 data frame with domain codes in the first column and the corresponding domain population sizes in the second column. The domains considered in popnsize must contain those specified in selectdom (D>=I).

method

a character string. If "REML", the model is fitted by maximizing the restricted log-likelihood. If "ML" the log-likelihood is maximized. Defaults to "REML".

data

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

Details

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:

eblup

data frame with number of rows equal to number of selected domains (selectdom), containing in its columns the domain codes (domain) and the EBLUPs of the means of selected domains based on the nested error linear regression model (eblup). For domains with zero sample size, the EBLUPs are the synthetic regression estimators.

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.

Cases with NA values in formula or dom are ignored.

References

- Battese, G.E., Harter, R.M. and Fuller, W.A. (1988). An Error-Components Model for Prediction of County Crop Areas Using Survey and Satellite Data, Journal of the American Statistical Association 83, 28-36.

- Rao, J.N.K. (2003). Small Area Estimation. New York: John Wiley and Sons.

See Also

pbmseBHF

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
# Load data set for segments (units within domains)
data(cornsoybean)

# Load data set for counties
data(cornsoybeanmeans)
attach(cornsoybeanmeans)

# Construct data frame with county means of auxiliary variables for 
# domains. First column must include the county code
Xmean <- data.frame(CountyIndex, MeanCornPixPerSeg, MeanSoyBeansPixPerSeg)
Popn  <- data.frame(CountyIndex, PopnSegments)

# Compute EBLUPs of county means of corn crop areas for all counties
resultCorn <- eblupBHF(CornHec ~ CornPix + SoyBeansPix, dom=County, 
                       meanxpop=Xmean, popnsize=Popn, data=cornsoybean)
resultCorn$eblup

# Compute EBLUPs of county means of soy beans crop areas for
# a subset of counties using ML method
domains <- c(10,1,5)
resultBean <- eblupBHF(SoyBeansHec ~ CornPix + SoyBeansPix, dom=County, 
                       selectdom=domains, meanxpop=Xmean, popnsize=Popn,
                       method="ML", data=cornsoybean)
resultBean$eblup
resultBean$fit

detach(cornsoybeanmeans)

Example output

Loading required package: MASS
Loading required package: lme4
Loading required package: Matrix
   domain    eblup sampsize
1       1 122.5825        1
2       2 123.5274        1
3       3 113.0343        1
4       4 114.9901        2
5       5 137.2660        3
6       6 108.9807        3
7       7 116.4839        3
8       8 122.7711        3
9       9 111.5648        4
10     10 124.1565        5
11     11 112.4626        5
12     12 131.2515        6
  domain     eblup sampsize
1     10 100.61124        5
2      1  78.63690        1
3      5  66.26077        3
$summary
Linear mixed model fit by maximum likelihood  ['lmerMod']
Formula: ys ~ -1 + Xs + (1 | dom)

     AIC      BIC   logLik deviance df.resid 
   323.2    331.2   -156.6    313.2       32 

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-1.9871 -0.5487 -0.1716  0.4525  1.8864 

Random effects:
 Groups   Name        Variance Std.Dev.
 dom      (Intercept) 219.3    14.81   
 Residual             170.3    13.05   
Number of obs: 37, groups:  dom, 12

Fixed effects:
               Estimate Std. Error t value
Xs(Intercept) -16.34566   25.46383  -0.642
XsCornPix       0.02807    0.05348   0.525
XsSoyBeansPix   0.49679    0.05537   8.972

Correlation of Fixed Effects:
            Xs(In) XsCrnP
XsCornPix   -0.935       
XsSoyBensPx -0.878  0.718

$fixed
Xs(Intercept)     XsCornPix XsSoyBeansPix 
 -16.34565854    0.02806513    0.49678511 

$random
   (Intercept)
1   -7.5341978
2    4.6221630
3   -6.3898804
4  -20.0120622
5  -19.7224381
6    0.1073779
7   13.8480569
8   10.2146579
9   -3.9717548
10   9.4323917
11  25.2797012
12  -5.8740155

$errorvar
[1] 170.2855

$refvar
[1] 219.3221

$loglike
[1] -156.5848

$residuals
 [1]  -5.8496848   3.5887294  -4.9612165 -16.9877875   1.4500676   1.3770236
 [7]  -2.9223939 -13.7674804   7.4177099 -25.9298102  18.5954704  24.6159854
[13]  -2.2390235 -11.6250849  -7.1633492  21.3097437  -6.2155529   6.8691125
[19]   5.9048206  -7.1602978  -8.6973762   2.8897097  -9.5627347  22.4392362
[25]  -4.8193887  -3.6233464  -7.0495500  18.1539675   0.8801249  -4.8172079
[31]  12.4602739 -11.5223532  -1.0827759   2.0509344   4.2551656 -10.7593676
[37]  12.4977069

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