sae
The sae collection implements Fay-Herriot area-level small-area estimation: a model-based technique for producing more precise estimates for small geographic or demographic areas than their direct (design-based) survey estimates allow.
A direct estimate for a small area — e.g. from fiadb or data.census_acs — carries large sampling variance when few samples fall in that area. The Fay-Herriot model treats each area's direct estimate as its true value plus sampling error, and relates the true value to area-level auxiliary covariates through a linear regression with an area-level random effect. Fitting the model (Fisher scoring, with REML/ML/FH variance estimation) borrows strength across areas to shrink noisy direct estimates toward the regression line, producing an EBLUP (Empirical Best Linear Unbiased Predictor) that is typically more precise than the direct estimate alone.
Three blocks build on the same model class and chain through a fitted model, a SpadeModel file (see models):
sae.all_subsets_fh— predictor selection. Given a pool of candidate covariates (a column selector such asB*,MB*), enumerates every subset up to a size limit, fits each by Fisher-scoring EBLUP, and selects the best model by AIC among those whose coefficients are all significant. Itsmodeloutput is the selected model, fitted.sae.fay_herriot— model fit. Fits a Fay-Herriot model on a given formula or set of features and writes the fittedmodel, the coefficient table and goodness-of-fit diagnostics.sae.fay_herriot_mse— estimates. Takes a fitted model from either block above and returns per-area EBLUP estimates with their Prasad-Rao mean squared error and precision diagnostics (SE ratio, relative efficiency versus the direct estimate). It does not refit: the model carries everything the MSE needs. Areas without a direct estimate get the synthetic (regression-only) prediction.
In practice: wire all_subsets_fh's model output straight into fay_herriot_mse -- no predictors to copy by hand. models.predict also scores a Fay-Herriot model, giving the synthetic prediction.
All three take Parquet or CSV and share the model-fitting arguments of the stats model blocks: target, a features column selector, id_columns, categorical, na_action. A missing or misspelled column fails with near-match suggestions and the list of columns that exist.
A fourth block, sae.hello_world, is a diagnostic/smoke-test block that verifies the R runtime executes correctly in a given environment — it is not a modeling tool, but a real, registered block that spade check/spade list will surface.
All blocks in this collection declare network: false — small-area estimation runs entirely on data already local to the pipeline.
Blocks🔗
| Block | Kind | Description |
|---|---|---|
sae.fay_herriot | standard | Fit a Fay-Herriot area-level EBLUP model; write the fitted model, coefficients and fit diagnostics |
sae.fay_herriot_mse | standard | Per-area EBLUP estimates with Prasad-Rao MSE from a fitted model |
sae.all_subsets_fh | standard | All-possible-subsets predictor selection; writes the selected model |
sae.hello_world | standard | Diagnostic block that verifies R execution (not a modeling tool) |
Installation🔗
spade install file:///path/to/blocks/saesae.fay_herriot
Fit a Fay-Herriot area-level small-area model (EBLUP) with Fisher scoring.
Read →sae.fay_herriot_mse
Per-area Fay-Herriot EBLUP estimates with Prasad-Rao MSE, from a fitted model.
Read →sae.all_subsets_fh
All-possible-subsets model selection for Fay-Herriot models; writes the selected model.
Read →sae.hello_world
Minimal base-R diagnostic block that writes a greeting; verifies R execution.
Read →