aggr: Compute aggregates of small area estimates and MSEs.

Description Usage Arguments Value See Also Examples

View source: R/hbsae.R

Description

Compute aggregates of small area estimates and MSEs.

Usage

1
  aggr(x, R)

Arguments

x

sae object.

R

aggregation matrix, r x M matrix where M is the number of areas and r the number of aggregate areas; default is aggregation over all areas.

Value

Object of class sae with aggregated small area estimates and MSEs.

See Also

sae-class

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
d <- generateFakeData()

# compute small area estimates
sae <- fSAE(y0 ~ x + area2, data=d$sam, area="area", popdata=d$Xpop)

# by default aggregate over all areas
global <- aggr(sae)
EST(global); SE(global)

# aggregation to broad area
# first build aggregation matrix
M <- d$Xpop[, c("area22", "area23", "area24")] / d$Xpop[, "(Intercept)"]
M <- cbind(1 - rowSums(M), M); colnames(M)[1] <- "area21"
est.area2 <- aggr(sae, M)
EST(est.area2); SE(est.area2)
COV(est.area2)  # covariance matrix

Example output

REML estimate of variance ratio: 0.2879
numerical integration of f(x) (normalization constant): 11.06 with absolute error < 7e-08
numerical integration of x*f(x): 3.542 with absolute error < 2e-08
posterior mean for variance ratio: 0.3203
[1] 221.3017
[1] 1.31611
  area21   area22   area23   area24 
188.3457 189.6165 254.4981 282.7922 
  area21   area22   area23   area24 
2.639206 2.293749 2.652971 3.129654 
              area21        area22        area23        area24
area21  6.9654089073 -0.0009095994  0.0021213211 -9.081502e-05
area22 -0.0004572583  5.2612861803 -0.0006379373  2.731048e-05
area23  0.0021870159 -0.0013083143  7.0382527792 -1.306230e-04
area24 -0.0001699394  0.0001016610 -0.0002370885  9.794734e+00

hbsae documentation built on May 29, 2017, 9:56 p.m.