Scenario model of the future reformed population of the city of Zurich | Read-only mirror of https://github.com/StatistikStadtZuerich/RelSzen — Stadt Zürich. Issues & pull requests at the source.
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Rosin Klemens (SSZ) a07ede7888 formatting with StyleR
2022-12-01 09:18:38 +01:00
renv initial commit 2022-11-30 13:21:45 +01:00
.gitignore no jpg and pdf on github 2022-11-30 15:57:52 +01:00
.Rprofile CRAN in Rprofile 2022-11-30 13:22:59 +01:00
00_run-all.r formatting with StyleR 2022-12-01 09:18:38 +01:00
10_birth-fertility.r formatting with StyleR 2022-12-01 09:18:38 +01:00
11_birth-rel.r formatting with StyleR 2022-12-01 09:18:38 +01:00
20_death.r formatting with StyleR 2022-12-01 09:18:38 +01:00
30_immigration.r formatting with StyleR 2022-12-01 09:18:38 +01:00
40_emigration.r formatting with StyleR 2022-12-01 09:18:38 +01:00
50_conversion.r formatting with StyleR 2022-12-01 09:18:38 +01:00
60_demography-popscen.r formatting with StyleR 2022-12-01 09:18:38 +01:00
70_area.r formatting with StyleR 2022-12-01 09:18:38 +01:00
90_general.r paths no longer relative (now to V-directory) 2022-11-30 15:48:52 +01:00
91_plot-functions.r initial code commits 2022-11-30 13:24:37 +01:00
92_constrained-regression.r initial code commits 2022-11-30 13:24:37 +01:00
93_life-expectancy.r initial code commits 2022-11-30 13:24:37 +01:00
LICENSE Initial commit 2022-11-30 13:12:27 +01:00
README.md additional inforation in ReadMe file 2022-11-30 17:18:23 +01:00
RelSzen.Rproj initial commit 2022-11-30 13:21:45 +01:00
renv.lock renv.lock file: more packages 2022-11-30 13:47:13 +01:00

RelSzen

Scenario model of the future reformed population of the city of Zurich

Model

Data

This R code calculates population scenarios for the future reformed population of the city of Zurich. For data protection reasons the input and output data are not available here. The results of the calculations are population sizes by the ten church districts, years, and age classes (10 year classes).

Model components

Code to run all modules

  • 00_run-all.r: run all modules

Calculate future rates

  • 10_birth-fertility.r: future fertility rate

  • 11_birth-rel.r: religion of mother and child

  • 20_death.r: mortality rates and life expectancy by religion

  • 30_immigration.r: future immigration rate

  • 40_emigration.r: future emigration rate

  • 50_conversion.r: future conversion rate

Core model

  • 60_demography-popscen.r: combine demographic processes and population scenarios

Area correction factors

  • 70_area.r: area factors

Functions

  • 90_general.r: general functions

  • 91_plot-functions.r: plot functions

  • 92_constrained-regression.r: constrained regression

  • 93_life-expectancy.r: functions to calculate life expectancy

Renv

To users

We use an renv enabled RStudio project to manage the local environment with libraries in order to ensure reproducible results, correct working directories etc. You can use the included one or create your own.
When you pull this repository, make sure to restart your R session (this is done automatically if you open this as an RStudio project). R will read the project specific .Rprofile file and thereby activate renv.
You can also activate it manually by using renv::activate(). This might lead to the download of many (potentially older) packages.
Keep in mind that you will be working in this specific environment as long as you're not switching to another project or manually deactivate renv (renv::deactivate()).

To contributors

If a new package is required, use renv::install("new package"). For updates, use renv::update("update_package").
Then add this to the lock file by running renv::snapshot() and commit the changes in renv.lock. A good overview can be found here

Author

Statistik Stadt Zürich