Description Usage Arguments Details Value Author(s) References See Also Examples
Calculates parametric bootstrap mean squared error estimates of the EBLUPs based on a spatiotemporal FayHerriot model with area effects following a SAR(1) process and with either uncorrelated or correlated time effects within each domain following an AR(1) process.
1 2 
formula 
an object of class 
D 
total number of domains. 
T 
total number of time instants (constant for each domain). 
vardir 
vector containing the 
proxmat 

B 
number of bootstrap replicates. Default value is 
model 
type of model to be chosen between 
MAXITER 
maximum number of iterations allowed for the Fisherscoring algorithm. Default value is 
PRECISION 
convergence tolerance limit for the Fisherscoring algorithm. Default value is 
data 
optional data frame containing the variables named in 
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.
The function returns a list with the following objects:
est 
a list with the results of the estimation process: 
mse 
a vector of length 
In case that formula
, vardir
or proxmat
contain NA values a message is printed and no action is done.
Yolanda Marhuenda, Isabel Molina and Domingo Morales.
 Small Area Methods for Poverty and Living Conditions Estimates (SAMPLE), funded by European Commission, Collaborative Project 217565, Call identifier FP7SSH20071.
 Marhuenda, Y., Molina, I. and Morales, D. (2013). Small area estimation with spatiotemporal FayHerriot models. Computational Statistics and Data Analysis 58, 308325.
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 36 37 38 39 40  data(spacetime) # Load data set
data(spacetimeprox) # Load proximity matrix
D < nrow(spacetimeprox) # number of domains
T < length(unique(spacetime$Time)) # number of time instant
# Calculate MSEs of EBLUPs under the spatiotemporal FayHerriot model
# with uncorrelated time effects nested within domains (model S)
set.seed(123)
resultS < pbmseSTFH(Y ~ X1 + X2, D, T, Var, spacetimeprox, B=40,
model="S", data=spacetime)
# Print direct estimates, variance, "S" model estimates, mse and
# residuals of the last time instant.
output < data.frame(Domain=spacetime$Area, Period=spacetime$Time,
Direct=spacetime$Y, EBLUP_S=resultS$est$eblup,
VarDirect=spacetime$Var, MSE_S=resultS$mse,
Residuals=spacetime$YresultS$est$eblup)
periods < unique(spacetime$Time)
lastperiod < periods[length(periods)]
print(output[output[,"Period"]==lastperiod,], row.names=FALSE)
# Calculate MSEs of the EBLUPs based on the spatiotemporal FayHerriot model
# with AR(1) time effects nested within each area
attach(spacetime)
set.seed(123)
resultST < pbmseSTFH(Y ~ X1 + X2, D, T, vardir=Var, spacetimeprox, B=40)
# Print direct estimates, variance, "ST" model estimates, mse and
# residuals of the last time instant.
output < data.frame(Domain=Area, Period=Time, Direct=Y,
EBLUP_ST=resultST$est$eblup, VarDirect=Var,
MSE_ST=resultST$mse,
Residuals=YresultST$est$eblup)
periods < unique(Time)
lastperiod < periods[length(periods)]
print(output[output[,"Period"]==lastperiod,], row.names=FALSE)
detach(spacetime)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs in the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.