Function saemodel()
is used to specify a model. Once a model
has been specified, it can be fitted using
fitsaemodel()
by different estimation methods.
saemodel(formula, area, data, type = "b", na.omit = FALSE)# S3 method for saemodel
print(x, ...)
# S3 method for saemodel
summary(object, ...)
# S3 method for saemodel
as.matrix(x, ...)
An instance of the S3 class "saemodel"
a formula
object of describing the fixed-effects
part of the model, with the response on the RHS of the ~
operator and the terms or regressors, separated by +
operators, on the LHS of the formula.
a one-sided formula
object. A ~
operator
followed by only one single term defining the area-specific
random-effect part.
data.frame.
[character]
"a"
or "b"
refering to
J.N.K. Rao's definition of model type A (area-level model) or B
(unit-level model); default is "b"
.
[logical]
indicating whether NA
values
should be removed before the computation proceeds. Note that none
of the algorithms can cope with missing values.
an object of class "saemodel"
.
an object of the class "saemodel"
.
additional arguments (not used).
Function saemodel()
is used to specify a model.
model
is a symbolic description (formula
of the
fixed-effects model to be fitted.
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 (explanatory variables); see
formula
.
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.
area
is a symbolic description (formula
) of
the random effects (nested error structure). It must be
right-hand side only formula consisting of one term,
e.g., ~ areaDefinition
.
The data must no contain missing values.
The design matrix (i.e., matrix of the explanatory variables
defined the right-hand side of model
) must have full column
rank; otherwise execution is terminated by an error.
Once a model has been specified, it can be fitted by
fitsaemodel()
.
Rao, J.N.K. (2003). Small Area Estimation, New York: John Wiley and Sons.
makedata()
,
fitsaemodel()
# use the landsat data
head(landsat)
# set up the model
model <- saemodel(formula = HACorn ~ PixelsCorn + PixelsSoybeans,
area = ~CountyName,
data = subset(landsat, subset = (outlier == FALSE)))
# summar of the model
summary(model)
Run the code above in your browser using DataLab