Learn R Programming

maSAE (version 2.0.3)

predict: Methods for Function predict

Description

Calculate small area predictions and their variances.

Usage

predict(object, ...)

# S4 method for sadObj predict(object)

# S4 method for saeObj predict(object, version = NULL, use_lm = NA)

Arguments

object

a model object for which prediction is desired.

...

Arguments to be passed to methods.

version

set to "1.0.0" or set options(maSAE_version = "1.0.0") to use the functions from maSAE 1.0.0. See NEWS.md for 2.0.0.

use_lm

Rather for internal use, stick with the default.

Value

A data frame containing predictions and variances for each small area, see Details above.

Methods

signature(object = saeObj)

Calculate predictions and variances according to the auxiliary information given, see Details above.

signature(object = sadObj)

Calculate design-based predictions and variances.

Details

Based on the structure of the saeObj given, predict decides, which predictor to use: If a smallAreaMeans-data.frame covering all fixed effects is given, the exhaustive estimator \(\hat{\tilde{y}}_{g, synth}\) is calculated. If a smallAreaMeans-data.frame not covering all fixed effects is given, the partially exhaustive estimator \(\hat{\tilde{y}}_{g, greg}\) is calculated. If no smallAreaMeans-data.frame but s1 is given, the three-phase estimator \(\hat{\tilde{y}}_{g, g3reg}\) is calculated. If neither smallAreaMeans nor s1 are given, the non-exhaustive estimator \(\hat{\tilde{y}}_{g, psynth}\) is calculated. If a clustering variable is given, the cluster sampling design equivalents of the above estimators are used. If version is not set to "1.0.0", the (pseudo) small and synthetic estimations and their variances are also calculated (see vignette("A_Taxonomy_of_Estimators", package = "maSAE"))

See Also

vignette(package = "maSAE")

Examples

Run this code
# NOT RUN {
## ## design-based estimation
## load data
data("s2", package = "maSAE")
## create object
saeO <- maSAE::saObj(data = s2, f = y ~ NULL | g)
## design-based estimation for all small areas given by g
maSAE::predict(saeO)
## ## model-assisted estimation
## load  data
data("s1", "s2", package = "maSAE")
str(s1)
s12 <- maSAE::bind_data(s1, s2)
## create object
saeO <- maSAE::saObj(data = s12, f = y ~ x1 + x2 + x3 | g, s2 = "phase2")
## small area estimation
maSAE::predict(saeO)
# }

Run the code above in your browser using DataLab