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 class 'saemodel'print(x,...)## S3 method for class 'saemodel'summary(object,...)## S3 method for class 'saemodel'as.matrix(x,...)
Arguments
formula: 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.
area: a one-sided formula object. A ~ operator followed by only one single term defining the area-specific random-effect part.
data: data.frame.
type: [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".
na.omit: [logical] indicating whether NA values should be removed before the computation proceeds. Note that none of the algorithms can cope with missing values.
x: an object of class "saemodel".
object: an object of the class "saemodel".
...: additional arguments (not used).
Details
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().
Returns
An instance of the S3 class "saemodel"
References
Rao, J.N.K. (2003). Small Area Estimation, New York: John Wiley and Sons.
See Also
makedata(), fitsaemodel()
Examples
# use the landsat datahead(landsat)# set up the modelmodel <- saemodel(formula = HACorn ~ PixelsCorn + PixelsSoybeans, area =~CountyName, data = subset(landsat, subset =(outlier ==FALSE)))# summar of the modelsummary(model)