Functions for producing EBLUP small area estimates of the dynamic or RaoYu time series models through either ML or REML estimation of the variance components. The functions can fit univariate or multivariate models.
1 2 3 4 5 
formula 
For a univariate model, a For a multivariate model, a list of formulas, one for each
dependent variable. The number of dependent variables, 
D 
The total number of domains. 
T 
The number of time instances (constant for all domains). 
vardir 
For the univariate model, the sampling covariance matrix
for the direct estimates of the For the multivariate model, the square covariance matrix for the

method 
Whether restricted maximum likelihood 
MAXITER 
The maximum number of iterations allowed for the Fisherscoring algorithm, with a default value of 100. 
PRECISION 
The convergence tolerance limit for the Fisherscoring algorithm, with a default value of .000001. 
data 
An optional data frame containing the variables named in

... 
Other parameters passed to 
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.
eblupDyn
and eblupRY
parse formula
by calling functions
within R
, then calling one of the functions reml.dyn
,
mle.dyn
, reml.Rao.Yu
or mle.Rao.Yu
.
As a last step, eblupDyn
and eblupRY
finalize the returned list.
The additional parameters passed to reml.dyn
etc.
include contrast.matrix
, which specifies linear combinations
of estimates within domains, such as the sum over dependent variables
or across time. Corresponding MSE estimates are provided for the contrasts.
Another argument is ids
, which accepts a data frame with D
rows of domain identifiers that is included in the list returned by
eblupDyn
or eblupRY
. Other parameters affect convergence
or provide starting values. If iter.history
is set to TRUE, the
returned object will include more items with values of
statistics at each step of the iteration; see reml.dyn
for details.
MSE estimation for REML for both the RaoYu and dynamic models follows the results summarized in Rao (2003, pp. 98105). The MSE estimates incorporate g1, g2, and g3 terms. Our simulations show that the REML estimates have somewhat smaller MSEs than the ML estimates, but this is not reflected in the comparison of the estimated MSEs returned by the functions. The MSE estimates under REML perform quite well on average. The MSE estimates for ML use the same estimator as for REML,but they are modest underestimates of the true MSE in the same simulations.
eblup 
In the univariate case, a vector of length 
fit 
A list summarizing the fit of the model with the following:

parm 
A labelled vector with the estimated variance components, correlations, and number of iterations. 
coef 
A labelled vector of coefficients of the model or models. 
ids 
A data frame with 
delta 
An ordered vector of the variance components, which may be used as starting values for additional iterations. 
eblup.mse 
MSE estimates for eblup. 
eblup.g1 
The g1 term of the MSE estimate. 
eblup.g2 
The g2 term of the MSE estimate. 
eblup.g3 
The g3 term of the MSE estimate. 
est.fixed 
Estimates based on fixed effects only. 
est.fixed.var 
The variancecovariance matrix for the estimates in

eblup.wt1 
Weights given to the direct estimate in forming 
eblup.wt2 
Weights given to the direct estimate, including effects through estimating the fixed effect coefficients. 
contrast.est 
Estimates requested by the specified contrasts. 
contrast.mse 
MSE estimates for 
contrast.g1 
The g1 term in the estimation of 
contrast.g2 
The g2 term in the estimation of 
contrast.g3 
The g3 term in the estimation of 
contrast.fixed.est 
Contrast estimates based on the fixed effect model. 
contrast.fixed.var 
Variance estimates for the fixed effect model. 
contrast.wt1 
Weight wt1 given to the direct estimate in estimating the contrasts. 
contrast.wt2 
Weight wt2 in estimating the contrasts. 
inf.mat 
Information matrix for the components of 
var.coef 
Variance covariance matrix for 
Robert E. Fay, Mamadou Diallo
 Fay, R.E. and Herriot, R.A. (1979). Estimation of income from small places: An application of JamesStein procedures to census data. Journal of the American Statistical Association 74, 269277.
 Fay, R.E., Planty, M. and Diallo, M.S. (2013). Small area estimates from the National Crime Victimization Survey. Proceedings of the Joint Statistical Meetings. American Statistical Association, pp. 15441557.
 Rao, J.N.K. (2003). Small Area Estimation. Wiley, New York.
 Rao, J.N.K. and Yu, M. (1994). Small area estimation by combining time series and crosssectional data. Canadian Journal of Statistics 22, 511528.
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  D < 20 # number of domains
T < 5 # number of years
set.seed(1)
data < data.frame(Y= mvrnormSeries(D=D, T=T, rho.dyn=.9, sigma.v.dyn=1,
sigma.u.dyn=.19, sigma.e=diag(5)), X=rep(1:T, times=D))
result.dyn < eblupDyn(Y ~ X, D, T, vardir = diag(100), data=data)
result.dyn$fit
require(sae)
data(spacetime) # Load data set from sae package
data(spacetimeprox) # Load proximity matrix
D < nrow(spacetimeprox) # number of domains
T < length(unique(spacetime$Time)) # number of time instants
# Fit model ST with AR(1) time effects for each domain
resultST < eblupSTFH(Y ~ X1 + X2, D, T, Var, spacetimeprox,
data=spacetime)
resultT < eblupDyn(Y ~ X1 + X2, D, T, vardir = diag(spacetime$Var),
data=spacetime, ids=spacetime$Area)
resultT.RY < eblupRY(Y ~ X1 + X2, D, T, vardir = diag(spacetime$Var),
data=spacetime, ids=spacetime$Area)
resultST$fit
resultT$fit
resultT.RY$fit
rowsT < seq(T, T*D, by=T)
data.frame(Domain=spacetime$Area[rowsT], Y=spacetime$Y[rowsT],
EBLUP_ST=resultST$eblup[rowsT],
EBLUB_Dyn=resultT$eblup[rowsT],
EBLUP_RY=resultT.RY$eblup[rowsT])

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.