Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

joseph-data/Small-Area-Estimation

Repository files navigation

Small-Area Estimation (SAE) — Sweden

R Python Google Earth Engine License: MIT

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.

Project write-up

Repository layout

.
├── 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)

Quick start (R)

  1. Restore R dependencies (recommended):

    install.packages("renv")
    renv::restore()
  2. Preprocess data + generate direct-estimate maps:

    source("R/3_visualization.R")
  3. Fit Fay–Herriot models + write model outputs:

    source("R/test4.R")
  4. Build the model summary table:

    source("R/report.R")

Inputs and outputs

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.

Optional: refresh SCB inputs (Python)

See Python_pull/README.md and run the notebooks in Python_pull/notebooks/. They currently write:

  • data/Pop_density.csv
  • data/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).

Contact

For questions or suggestions, please open an issue or reach out via https://github.com/joseph-data

About

This is the repo that hosts my Master's Thesis Code

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

AltStyle によって変換されたページ (->オリジナル) /