Reproducible workflow for county-level unemployment small-area estimation in Sweden using Fay–Herriot area-level models (R), with optional Python notebooks for pulling SCB inputs and a Google Earth Engine script for geospatial covariates.
- Thesis PDF:
documentation/Msc Thesis II.pdf
.
├── R/ # R scripts (preprocess, visualization, SAE models)
├── Python_pull/ # Python notebooks to pull SCB inputs (PXWeb)
├── data/ # Inputs (SCB, GEE), shapefiles, and intermediate .RData
├── outputs/ # Generated figures/maps/reports (gitignored)
├── renv.lock, renv/ # R dependency lock + bootstrap
├── pyproject.toml, uv.lock # Python project metadata + lock (minimal)
└── qmarkdown/ # Thesis supporting document (Quarto)
-
Restore R dependencies (recommended):
install.packages("renv") renv::restore()
-
Preprocess data + generate direct-estimate maps:
source("R/3_visualization.R") -
Fit Fay–Herriot models + write model outputs:
source("R/test4.R") -
Build the model summary table:
source("R/report.R")
Key inputs used by R/2_sweden_preprocess.R:
data/SWE_adm/SWE_adm1.shp(county boundaries)data/direct_estimates.csv(direct unemployment estimates)data/geodata.csv(GEE-derived covariates)data/popdensity.csv(population density)data/vacancies.csv(job vacancies)
Common outputs:
data/processed_sweden.RData(processed data objects)outputs/html/sweden_direct_map.html(interactive map)outputs/img/sweden_direct_map_*.png(static maps)outputs/sae/(SAE model artifacts, e.g.fh_models.rds, plots, tables)
outputs/ is generated and ignored by git.
See Python_pull/README.md and run the notebooks in Python_pull/notebooks/. They currently write:
data/Pop_density.csvdata/UnempDirect.csv
If you want these to feed the R pipeline as-is, rename them to match the filenames expected by R/2_sweden_preprocess.R (or update the R script).
For questions or suggestions, please open an issue or reach out via https://github.com/joseph-data