tr-nufus 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. tr_nufus-0.1.0/CHANGELOG.md +24 -0
  2. tr_nufus-0.1.0/CITATION.cff +22 -0
  3. tr_nufus-0.1.0/LICENSE +21 -0
  4. tr_nufus-0.1.0/MANIFEST.in +9 -0
  5. tr_nufus-0.1.0/PKG-INFO +374 -0
  6. tr_nufus-0.1.0/README.md +335 -0
  7. tr_nufus-0.1.0/examples/kohort_ornek.json +121 -0
  8. tr_nufus-0.1.0/examples/ornekkent.csv +8 -0
  9. tr_nufus-0.1.0/examples/quickstart.py +56 -0
  10. tr_nufus-0.1.0/pyproject.toml +113 -0
  11. tr_nufus-0.1.0/setup.cfg +4 -0
  12. tr_nufus-0.1.0/src/tr_nufus/__init__.py +124 -0
  13. tr_nufus-0.1.0/src/tr_nufus/__main__.py +7 -0
  14. tr_nufus-0.1.0/src/tr_nufus/_version.py +1 -0
  15. tr_nufus-0.1.0/src/tr_nufus/cli.py +332 -0
  16. tr_nufus-0.1.0/src/tr_nufus/cohort.py +421 -0
  17. tr_nufus-0.1.0/src/tr_nufus/evaluate.py +90 -0
  18. tr_nufus-0.1.0/src/tr_nufus/methods.py +736 -0
  19. tr_nufus-0.1.0/src/tr_nufus/py.typed +0 -0
  20. tr_nufus-0.1.0/src/tr_nufus/rates.py +116 -0
  21. tr_nufus-0.1.0/src/tr_nufus/report.py +244 -0
  22. tr_nufus-0.1.0/src/tr_nufus/series.py +253 -0
  23. tr_nufus-0.1.0/src/tr_nufus.egg-info/PKG-INFO +374 -0
  24. tr_nufus-0.1.0/src/tr_nufus.egg-info/SOURCES.txt +31 -0
  25. tr_nufus-0.1.0/src/tr_nufus.egg-info/dependency_links.txt +1 -0
  26. tr_nufus-0.1.0/src/tr_nufus.egg-info/entry_points.txt +2 -0
  27. tr_nufus-0.1.0/src/tr_nufus.egg-info/requires.txt +7 -0
  28. tr_nufus-0.1.0/src/tr_nufus.egg-info/top_level.txt +1 -0
  29. tr_nufus-0.1.0/tests/test_cli.py +185 -0
  30. tr_nufus-0.1.0/tests/test_cohort.py +136 -0
  31. tr_nufus-0.1.0/tests/test_methods.py +298 -0
  32. tr_nufus-0.1.0/tests/test_report_eval.py +132 -0
  33. tr_nufus-0.1.0/tests/test_series_rates.py +175 -0
@@ -0,0 +1,24 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [Unreleased]
6
+
7
+ ## [0.1.0] - 2026-11-09
8
+ ### Added
9
+ - `CensusSeries`: census / ADNKS series from dicts, pairs or CSV (`;`, `,`, tab; Turkish
10
+ and English column names; Turkish thousands separators), train/test split.
11
+ - TÜİK annual growth rate in per mille (`r = ln(Pt/P0)/t × 1000`), compound rate,
12
+ doubling time, interval growth table.
13
+ - Projection methods: arithmetic, geometric, exponential (endpoints, mean of consecutive
14
+ intervals, least squares), İller Bankası (first-last census per İller Bankası 2013, or
15
+ mean of consecutive rates per ÇŞB 2018; 1 %-3 % bounds, overridable), logistic
16
+ (three equally spaced censuses and least squares with Levenberg-Marquardt polish),
17
+ least-squares linear and polynomial trend, ratio (share of a larger area).
18
+ - Two-sex cohort-component projection with Leslie matrices (survival ratios, age-specific
19
+ fertility, sex ratio at birth, net migration at end or half-period), dominant eigenvalue,
20
+ survival ratios from life-table `nLx`.
21
+ - Back-testing against held-out census years with MAPE.
22
+ - Turkish report tables (Markdown / text / CSV) and a plan-report section generator.
23
+ - `tr-nufus` command line interface in Turkish: `hiz`, `projeksiyon`, `karsilastir`,
24
+ `kohort`, `ornek`, `yontemler`.
@@ -0,0 +1,22 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use this software, please cite it as below."
3
+ authors:
4
+ - family-names: "Eminoğlu"
5
+ given-names: "Yusuf"
6
+ email: "geospacephilo@gmail.com"
7
+ orcid: "https://orcid.org/0009-0005-6000-2934"
8
+ title: "tr-nufus"
9
+ version: "0.1.0"
10
+ date-released: "2026-11-09"
11
+ license: "MIT"
12
+ repository-code: "https://github.com/YusufEminoglu/tr_nufus_sdk"
13
+ url: "https://pypi.org/project/tr-nufus/"
14
+ abstract: "Population projection methods used in Turkish plan reports and planning education: arithmetic, geometric, exponential, logistic (three-point and least squares), İller Bankası, least-squares polynomial trend, ratio (share) and two-sex cohort-component projection with Leslie matrices; TÜİK annual growth rate (per mille), doubling time, MAPE back-testing against held-out censuses and Turkish Markdown report tables."
15
+ keywords:
16
+ - population projection
17
+ - demography
18
+ - urban planning
19
+ - İller Bankası
20
+ - TÜİK
21
+ - cohort-component
22
+ - Leslie matrix
tr_nufus-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yusuf Eminoğlu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,9 @@
1
+ include LICENSE
2
+ include README.md
3
+ include CHANGELOG.md
4
+ include CITATION.cff
5
+ include pyproject.toml
6
+ include src/tr_nufus/py.typed
7
+ recursive-include src/tr_nufus *.py
8
+ recursive-include tests *.py
9
+ recursive-include examples *.py *.csv *.json
@@ -0,0 +1,374 @@
1
+ Metadata-Version: 2.4
2
+ Name: tr-nufus
3
+ Version: 0.1.0
4
+ Summary: Population projection methods for Turkish plan reports: arithmetic, geometric, exponential, logistic, İller Bankası, least-squares trend, ratio and cohort-component (Leslie) projections, TÜİK growth rates and MAPE back-testing.
5
+ Author-email: Yusuf Eminoğlu <geospacephilo@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/YusufEminoglu/tr_nufus_sdk
8
+ Project-URL: Repository, https://github.com/YusufEminoglu/tr_nufus_sdk
9
+ Project-URL: Issues, https://github.com/YusufEminoglu/tr_nufus_sdk/issues
10
+ Project-URL: Changelog, https://github.com/YusufEminoglu/tr_nufus_sdk/blob/main/CHANGELOG.md
11
+ Keywords: population-projection,nufus-projeksiyonu,demography,urban-planning,imar-plani,iller-bankasi,tuik,adnks,logistic-growth,cohort-component,leslie-matrix,turkey,turkiye
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Operating System :: OS Independent
20
+ Classifier: Environment :: Console
21
+ Classifier: Natural Language :: Turkish
22
+ Classifier: Natural Language :: English
23
+ Classifier: Topic :: Scientific/Engineering
24
+ Classifier: Topic :: Scientific/Engineering :: GIS
25
+ Classifier: Topic :: Sociology
26
+ Classifier: Intended Audience :: Science/Research
27
+ Classifier: Intended Audience :: Education
28
+ Classifier: Typing :: Typed
29
+ Requires-Python: >=3.9
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ Requires-Dist: numpy>=1.21
33
+ Provides-Extra: dev
34
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
35
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
36
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
37
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
38
+ Dynamic: license-file
39
+
40
+ # tr-nufus
41
+
42
+ [![PyPI version](https://img.shields.io/pypi/v/tr-nufus.svg?color=10b981)](https://pypi.org/project/tr-nufus/)
43
+ [![Python version support](https://img.shields.io/pypi/pyversions/tr-nufus.svg?color=3b82f6)](https://pypi.org/project/tr-nufus/)
44
+ [![CI](https://github.com/YusufEminoglu/tr_nufus_sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/YusufEminoglu/tr_nufus_sdk/actions/workflows/ci.yml)
45
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/YusufEminoglu/tr_nufus_sdk/blob/main/LICENSE)
46
+
47
+ **English summary.** `tr-nufus` implements the population projection methods
48
+ used in Turkish development-plan reports (*plan açıklama raporu*), İller
49
+ Bankası infrastructure projects and planning education: arithmetic, geometric,
50
+ exponential, logistic (three-point and least squares), the İller Bankası
51
+ method, least-squares trends, the ratio (share) method and a two-sex
52
+ cohort-component projection with Leslie matrices. It also computes TÜİK's
53
+ annual growth rate in per mille, doubling times, back-tests methods against
54
+ held-out census years (MAPE) and writes Turkish Markdown tables, from Python or
55
+ from the Turkish-language `tr-nufus` command line tool.
56
+
57
+ ---
58
+
59
+ **Türkçe.** `tr-nufus`, imar planı açıklama raporlarında, İller Bankası
60
+ içmesuyu/kanalizasyon projelerinde ve şehir planlama derslerinde kullanılan
61
+ nüfus projeksiyonu yöntemlerini tek bir küçük Python paketinde toplar:
62
+
63
+ - **Aritmetik (doğrusal) artış**, **geometrik artış**, **üstel (eksponansiyel) artış**
64
+ - **İller Bankası yöntemi** (çoğalma katsayısı %1-%3 aralığına sınırlanır; kaynağı aşağıda)
65
+ - **Lojistik eğri**: eşit aralıklı üç sayımdan (Pearl-Reed) ve en küçük kareler ile
66
+ - **En küçük kareler doğrusal / polinom trendi**
67
+ - **Oran (pay) yöntemi**: ilçenin il (ya da bölge) projeksiyonundaki payı
68
+ - **Kohort bileşenler yöntemi**: yaş grubu × cinsiyet, hayatta kalma oranları,
69
+ doğurganlık, net göç; Leslie matrisi
70
+ - TÜİK tanımıyla **yıllık nüfus artış hızı (‰)**, **ikiye katlanma süresi**
71
+ - Son sayım(lar)ı dışarıda bırakarak **yöntem karşılaştırması (MAPE)**
72
+ - Plan raporuna doğrudan yapıştırılabilen **Türkçe Markdown / CSV tablolar**
73
+
74
+ Tek bağımlılık `numpy`'dir. Python 3.9 ve üzeri gerekir.
75
+
76
+ > **Veri notu.** Paket TÜİK verisi içermez. ADNKS (Adrese Dayalı Nüfus Kayıt
77
+ > Sistemi) ve genel nüfus sayımı rakamlarını kendiniz
78
+ > [TÜİK Veri Portalı](https://data.tuik.gov.tr)'ndan alıp verirsiniz. Örneklerde
79
+ > kullanılan "Örnekkent" verileri **tamamen varsayımsaldır**.
80
+
81
+ ## Kurulum
82
+
83
+ ```bash
84
+ pip install tr-nufus
85
+ ```
86
+
87
+ ## Hızlı başlangıç (komut satırı)
88
+
89
+ Girdi, iki sütunlu bir CSV dosyasıdır (`;`, `,` veya sekme ile ayrılmış;
90
+ `yil;nufus`, `Yıl;Nüfus`, `year,population` gibi başlıklar tanınır;
91
+ `1.234.567` biçimindeki binlik ayraçları okunur):
92
+
93
+ ```text
94
+ yil;nufus
95
+ 1990;38400
96
+ 2000;46900
97
+ 2010;55300
98
+ 2015;59800
99
+ 2020;63900
100
+ 2023;66100
101
+ ```
102
+
103
+ ```bash
104
+ tr-nufus ornek > ornekkent.csv # varsayımsal örnek veri
105
+ tr-nufus hiz ornekkent.csv # dönemlik yıllık artış hızı (‰)
106
+ tr-nufus projeksiyon ornekkent.csv --hedef 2030 2040 2058
107
+ tr-nufus karsilastir ornekkent.csv --test 1
108
+ tr-nufus projeksiyon ornekkent.csv --rapor --test 1 -o nufus_bolumu.md
109
+ tr-nufus hiz --seri "2017=80810525,2018=82003882,2019=83154997"
110
+ ```
111
+
112
+ `tr-nufus projeksiyon ornekkent.csv --hedef 2030 2040 2058` çıktısı:
113
+
114
+ | Yöntem | 2030 | 2040 | 2058 | Parametre |
115
+ | :--- | ---: | ---: | ---: | :--- |
116
+ | Aritmetik artış | 71.976 | 80.370 | 95.479 | ka = 839,4 kişi/yıl |
117
+ | Geometrik artış | 74.171 | 87.440 | 117.589 | r = %1,659 /yıl |
118
+ | Üstel (eksponansiyel) artış (en küçük kareler) | 75.640 | 89.170 | 119.911 | r = ‰16,46 /yıl |
119
+ | İller Bankası yöntemi | 74.171 | 87.440 | 117.589 | Ç = %1,659 |
120
+ | Lojistik eğri (en küçük kareler) | 71.422 | 78.032 | 87.103 | K = 100.806, r = 0,0343 /yıl, bükülme yılı ≈ 2004,1 |
121
+ | Lojistik eğri (üç nokta: 2000, 2010, 2020) | 72.355 | 80.344 | 92.800 | K = 120.597, r = 0,0286 /yıl, bükülme yılı ≈ 2015,8 |
122
+ | En küçük kareler doğrusal trend | 72.250 | 80.701 | 95.912 | P = 55.067 + 845,084·x, x = t − 2009,7 |
123
+ | En küçük kareler 2. derece polinom | 71.994 | 80.087 | 94.337 | P = 55.150 + 841,206·x − 0,630·x², x = t − 2009,7 |
124
+
125
+ `tr-nufus karsilastir ornekkent.csv --test 1` (yöntemler 1990-2020 verisiyle
126
+ kurulur, 2023 değeriyle sınanır):
127
+
128
+ | Sıra | Yöntem | 2023 tahmini | MAPE (%) |
129
+ | :--- | :--- | ---: | ---: |
130
+ | Gerçek | TÜİK / sayım değeri | 66.100 | - |
131
+ | 1 | Lojistik eğri (en küçük kareler) | 66.338 | 0,36 |
132
+ | 2 | Aritmetik artış | 66.450 | 0,53 |
133
+ | 3 | Lojistik eğri (üç nokta) | 66.467 | 0,56 |
134
+ | ... | ... | ... | ... |
135
+
136
+ Komutlar:
137
+
138
+ | Komut | İşlev |
139
+ | :--- | :--- |
140
+ | `hiz` | Ardışık sayımlar arası nüfus artışı, yıllık artış hızı (‰), bileşik artış (%), ikiye katlanma süresi |
141
+ | `projeksiyon` | Hedef yıllar için yöntem tablosu; `--rapor` ile tam plan raporu bölümü (geçmiş gelişim + projeksiyon + `--test` ile sınama) |
142
+ | `karsilastir` | Son `--test` sayımı dışarıda bırakıp her yöntemi sınar, MAPE'ye göre sıralar |
143
+ | `kohort` | JSON yapılandırmasından kohort bileşenler projeksiyonu (`--yil` ile yaş-cinsiyet tablosu) |
144
+ | `ornek` | Varsayımsal örnek CSV; `--kohort` ile örnek kohort yapılandırması (JSON) |
145
+ | `yontemler` | Yöntem anahtarlarını listeler |
146
+
147
+ Önemli seçenekler: `--yontem aritmetik iller_bankasi lojistik ...`,
148
+ `--hedef 2030 2035`, `--ufuk 35 --adim 5` (hedef verilmezse son sayımdan
149
+ sonraki 35 yıl, 5'er yıllık), `--ilbank-mod endpoints|mean_consecutive`,
150
+ `--sinirsiz` (İller Bankası %1-%3 sınırını kaldırır), `--doygunluk K`
151
+ (lojistik doygunluk nüfusu), `--derece 2`, `--bicim markdown|text|csv`, `-o dosya`.
152
+
153
+ ## Python API
154
+
155
+ ```python
156
+ from tr_nufus import (
157
+ CensusSeries, fit, fit_iller_bankasi, fit_logistic_three_point, fit_ratio,
158
+ annual_growth_rate_permille, doubling_time, compare_methods,
159
+ projection_table, plan_report,
160
+ )
161
+
162
+ s = CensusSeries.from_csv("ornekkent.csv", name="Örnekkent")
163
+ # ya da: CensusSeries.from_mapping({2000: 46_900, 2010: 55_300, 2023: 66_100})
164
+
165
+ annual_growth_rate_permille(82_003_882, 83_154_997, 1) # 13.94 (TÜİK: binde 13,9)
166
+ doubling_time(16.46) # 42.1 yıl
167
+
168
+ ib = fit_iller_bankasi(s) # İller Bankası 2013: ilk ve son sayım
169
+ ib.params # {'k': 1.659, 's': 1.659, 't_s': 2023.0, 'P_s': 66100.0}
170
+ ib.at(2058) # 117 589
171
+ fit_iller_bankasi(s, mode="mean_consecutive") # ÇŞB 2018: ardışık oranların ortalaması
172
+ fit_iller_bankasi(s, bounds=None) # sınırsız (geometrik)
173
+
174
+ lojistik = fit_logistic_three_point(s) # eşit aralıklı 2000-2010-2020
175
+ lojistik.params["K"] # doygunluk nüfusu
176
+
177
+ models = [fit(s, k) for k in ("aritmetik", "geometrik", "iller_bankasi", "lojistik")]
178
+ print(projection_table(models, [2030, 2040, 2050]))
179
+
180
+ comp = compare_methods(s, n_test=1) # son sayımı dışarıda bırak, MAPE
181
+ comp.best.label, comp.best.mape
182
+ print(plan_report(s, models, [2030, 2040, 2050], comp))
183
+ ```
184
+
185
+ Oran yöntemi (ilçenin il projeksiyonundaki payı); büyük alanın gelecekteki
186
+ nüfusu bir sözlük (örneğin TÜİK il projeksiyonu) ya da başka bir modeldir:
187
+
188
+ ```python
189
+ ilce = CensusSeries.from_mapping({2010: 52_000, 2020: 61_000})
190
+ il = CensusSeries.from_mapping({2010: 1_050_000, 2020: 1_160_000})
191
+ m = fit_ratio(ilce, il, {2030: 1_260_000, 2040: 1_330_000}, trend="linear")
192
+ m.predict([2030, 2040])
193
+ ```
194
+
195
+ Kohort bileşenler yöntemi:
196
+
197
+ ```python
198
+ from tr_nufus import CohortComponentModel, example_cohort_config, leslie_matrix, dominant_growth
199
+
200
+ model = CohortComponentModel(
201
+ base_female=[...], base_male=[...], # 0-4, 5-9, ..., 65+ (n grup)
202
+ survival_female=[...], survival_male=[...], # S[i] = nL(i+1)/nL(i); son değer açık grup
203
+ fertility=[...], # yaşa özel yıllık doğurganlık hızları
204
+ birth_survival_female=0.992, birth_survival_male=0.990, # 5L0 / (5·l0)
205
+ srb=1.05, # doğumda cinsiyet oranı (erkek/kız)
206
+ net_migration_female=[...], net_migration_male=[...], # 5 yıllık net göç
207
+ base_year=2023, timing="end", # göç dönem sonunda ya da "half"
208
+ )
209
+ proj = model.project(steps=4) # 2023, 2028, ..., 2043
210
+ proj.as_dict(); proj.age_table(2033)
211
+ lam, r = dominant_growth(model.leslie_female) # kapalı nüfusun içsel artış hızı
212
+ ```
213
+
214
+ Hayat tablosundan hayatta kalma oranları: `survival_ratios_from_Lx(nLx)`.
215
+ Örnek yapılandırma: `tr-nufus ornek --kohort` ya da `example_cohort_config()`
216
+ (varsayımsal).
217
+
218
+ ### API özeti
219
+
220
+ | Nesne | Açıklama |
221
+ | :--- | :--- |
222
+ | `CensusSeries` | Yıl → nüfus serisi; `from_mapping`, `from_pairs`, `from_csv`, `split`, `subset` |
223
+ | `annual_growth_rate_permille`, `doubling_time`, `interval_rates`, `overall_rate` | Artış hızları |
224
+ | `fit_arithmetic`, `fit_geometric`, `fit_exponential` | `mode="endpoints"`, `"mean_consecutive"` (üstelde ayrıca `"least_squares"`) |
225
+ | `fit_iller_bankasi` | `mode=`, `bounds=(1, 3)` |
226
+ | `fit_logistic_three_point`, `fit_logistic` | Lojistik; `saturation=` ile K verilebilir |
227
+ | `fit_polynomial`, `fit_linear_trend` | En küçük kareler trendi |
228
+ | `fit_ratio` | Oran (pay) yöntemi; `trend="constant" / "mean" / "linear"` |
229
+ | `fit(series, "anahtar")`, `METHODS` | Anahtarla yöntem seçimi |
230
+ | `Projection.predict`, `.at`, `.params`, `.label`, `.formula` | Ortak model arayüzü |
231
+ | `CohortComponentModel`, `leslie_matrix`, `dominant_growth`, `survival_ratios_from_Lx` | Kohort bileşenler |
232
+ | `compare_methods`, `mape` | Sınama |
233
+ | `growth_table`, `projection_table`, `comparison_table`, `cohort_table`, `plan_report`, `format_tr` | Türkçe tablolar |
234
+
235
+ Yöntem anahtarları: `aritmetik`, `geometrik`, `ustel`, `iller_bankasi`,
236
+ `lojistik`, `lojistik_3nokta`, `dogrusal_trend`, `polinom` (İngilizce takma
237
+ adlar da kabul edilir: `arithmetic`, `geometric`, `exponential`, `logistic`,
238
+ `logistic3`, `linear_trend`, `polynomial`). `fit(s, "ustel")` en küçük kareler
239
+ üstel eğrisini verir; iki uç sayıma dayalı üstel model `fit_exponential(s)`
240
+ ile alınır ve geometrik modelle aynı projeksiyonu üretir.
241
+
242
+ ## Yöntemler, formüller ve kaynaklar
243
+
244
+ Gösterim: `NS`, `tS` son sayım; `NE`, `tE` ilk sayım; `NG` hedef yıl `tG`
245
+ nüfusu. Sayım temelli yöntemler (aritmetik, geometrik, üstel, İller Bankası)
246
+ **son sayımdan başlar**; en küçük kareler yöntemleri eğrinin kendisini kullanır.
247
+
248
+ **TÜİK yıllık nüfus artış hızı (‰).** `r = ln(Pt / P0) / t × 1000`. TÜİK ADNKS
249
+ haber bültenlerinde yayımlanan değerlerle sınandı (testlerde): Türkiye nüfusu
250
+ 2017→2018 binde 14,7; 2018→2019 binde 13,9; 2022→2023 binde 1,1; 2023→2024
251
+ binde 3,4; 2024→2025 binde 5,0. 2018→2019 için basit yüzde değişim binde 14,0
252
+ verirdi; yayımlanan 13,9 logaritmik tanımı doğrular. İkiye katlanma süresi
253
+ `T = ln 2 / (r/1000)`.
254
+
255
+ **Aritmetik artış.** `ka = (NS − NE) / (tS − tE)`, `NG = NS + ka (tG − tS)`
256
+ (İller Bankası 2013, Ek-1). `mode="mean_consecutive"`: ardışık dönemlerin
257
+ yıllık artışlarının ortalaması (ÇŞB 2018, Ek-1 md. 1.3.2.1.1).
258
+
259
+ **Geometrik / üstel artış.** `r = [(NS/NE)^(1/(tS−tE)) − 1]`,
260
+ `NG = NS (1 + r)^(tG−tS)`; üstel: `r = (ln NS − ln NE)/(tS − tE)`,
261
+ `NG = NS e^(r (tG−tS))` (İller Bankası 2013, Ek-1 "Geometrik Artış
262
+ (Eksponansiyel) Yöntemi"; ÇŞB 2018 denklem 1.3.b-c ardışık hızların
263
+ ortalamasıyla). İki uç noktadan kurulduğunda iki model aynı sonucu verir.
264
+
265
+ **İller Bankası yöntemi.** Geometrik artışın sınırlandırılmış biçimidir:
266
+
267
+ ```text
268
+ Ç = [ (NS / NE)^(1 / (tS − tE)) − 1 ] × 100 (çoğalma katsayısı, %)
269
+ Ç < 1 ise Ç = 1; 1 ≤ Ç ≤ 3 ise Ç; Ç > 3 ise Ç = 3
270
+ NG = NS × (1 + Ç/100)^(tG − tS)
271
+ ```
272
+
273
+ - *İller Bankası A.Ş., İçmesuyu Tesisleri Etüt, Fizibilite ve Projelerinin
274
+ Hazırlanmasına Ait Teknik Şartname (2013)*, md. 4.4.2 ve Ek-1 "Nüfus
275
+ Projeksiyonu Yöntemleri": Ç ilk (`NE`) ve son (`NS`) sayımdan hesaplanır;
276
+ nüfus projeksiyonunda biri İller Bankası yöntemi olmak üzere en az üç yöntem
277
+ kullanılır; inşaat bitiminden sonra 30 yıl + işletmeye alınmaya kadar 5 yıl
278
+ = 5'er yıllık aralıklarla 35 yıllık projeksiyon (`NG = NS (1+Ç/100)^(n+5+30)`).
279
+ [jmo.org.tr kopyası](https://www.jmo.org.tr/mevzuat/mevzuat_detay_pdf.php?kod=233)
280
+ - *T.C. Çevre ve Şehircilik Bakanlığı, Kanalizasyon Sistemlerinin Etüt, Planlama
281
+ ve Projelendirilmesine İlişkin Teknik Esaslar, Ek-1 (2018)*, md. 1.3.2.1.2,
282
+ denklem 1.2.b-d: ardışık sayımlar için `s` değerlerinin aritmetik ortalaması
283
+ alınır ve `k = 1 (s̄ < 1)`, `k = s̄ (1 ≤ s̄ ≤ 3)`, `k = 3 (s̄ > 3)` uygulanır.
284
+ [csb.gov.tr](https://webdosya.csb.gov.tr/db/altyapi/icerikler/ekler-20180215122652.pdf)
285
+
286
+ `fit_iller_bankasi(mode="endpoints")` (varsayılan) İller Bankası 2013
287
+ şartnamesini, `mode="mean_consecutive"` ÇŞB 2018 esaslarını izler. Sınırlar
288
+ `bounds=` ile değiştirilebilir ya da kaldırılabilir.
289
+
290
+ **Lojistik eğri.** `P(t) = K / (1 + m e^(−r (t − t0)))` (Pearl & Reed 1920).
291
+ Eşit aralıklı (`n` yıl) üç sayım `P0, P1, P2` için:
292
+ `K = (2 P0 P1 P2 − P1² (P0 + P2)) / (P0 P2 − P1²)`, `m = (K − P0)/P0`,
293
+ `r = (1/n) ln[P1 (K − P0) / (P0 (K − P1))]`. Yalnızca artış yavaşlıyorsa
294
+ (`P1² > P0 P2`) doygunluk nüfusu vardır; aksi halde hata verilir. En küçük
295
+ kareler sürümü (`fit_logistic`) herhangi sayıda ve aralıkta sayım kullanır:
296
+ `K` taraması ve altın oran araması ile başlangıç değerleri bulunur, ardından
297
+ `(K, m, r)` Levenberg-Marquardt ile nüfus biriminde hata kareleri toplamını
298
+ en aza indirecek biçimde iyileştirilir. Doygunluk nüfusu plandan biliniyorsa
299
+ `saturation=` ile verilebilir.
300
+
301
+ **En küçük kareler trendi.** `numpy.polyfit` ile yıllar ortalamaya göre
302
+ merkezlenerek doğrusal ya da polinom eğri. Yüksek dereceler dışa
303
+ kestirimde kararsızdır; 1. veya 2. derece önerilir.
304
+
305
+ **Oran (pay) yöntemi.** `P(t) = s(t) × P_büyük(t)`, `s = P_küçük / P_büyük`;
306
+ pay sabit (son pay), ortalama ya da doğrusal eğilimle sürdürülür (Smith,
307
+ Tayman & Swanson 2013, *A Practitioner's Guide to State and Local Population
308
+ Projections*, Springer).
309
+
310
+ **Kohort bileşenler yöntemi.** Preston, Heuveline & Guillot (2001),
311
+ *Demography: Measuring and Modeling Population Processes*, böl. 6; Leslie
312
+ (1945), *Biometrika* 33(3). Bir adım = yaş grubu genişliği (genellikle 5 yıl):
313
+
314
+ ```text
315
+ W(i+1, t+5) = S(i) · W(i, t) (son grup: S(n−2)·W(n−2) + S(n−1)·W(n−1))
316
+ Doğumlar = 5/2 · Σ [ f(i) + f(i+1) · S(i) ] · W(i, t)
317
+ Kız 0-4 = Doğumlar · bs_k / (1 + SRB), Erkek 0-4 = Doğumlar · bs_e · SRB / (1 + SRB)
318
+ ```
319
+
320
+ Net göç dönem sonunda eklenir (`timing="end"`) ya da yarısı dönem başında,
321
+ yarısı sonunda (`timing="half"`). Kadın Leslie matrisinin baskın özdeğeri
322
+ `λ` kapalı nüfusun 5 yıllık artış çarpanıdır (`dominant_growth`).
323
+
324
+ **MAPE.** `100/n × Σ |Gerçek − Tahmin| / Gerçek`. `compare_methods` modeli
325
+ son `n_test` gözlem dışarıda bırakılarak kurar ve bu gözlemlerle sınar.
326
+
327
+ ## Sınırlar ve uyarılar
328
+
329
+ - Matematiksel yöntemler geçmiş eğilimi sürdürür; göç, imar planı kararları,
330
+ afet sonrası yer değiştirme, üniversite / askeri nüfus ve mevsimlik nüfus ayrıca
331
+ değerlendirilmelidir (İller Bankası 2013, md. 4.4.2 de bunu ister).
332
+ - İller Bankası yöntemi varsayılan sınırlarla nüfusu azalan bir yerleşimi bile
333
+ yılda %1 artırır; bu yöntemin özelliğidir, raporda belirtin.
334
+ - 2007 öncesi genel nüfus sayımları (Ekim ayı, *de facto*) ile ADNKS (31
335
+ Aralık, ikamet esaslı) sonuçları doğrudan karşılaştırılabilir değildir; kesirli
336
+ yıl (örn. 2000,79) girilebilir ama tanım farkını paket düzeltmez.
337
+ - Kohort modeli sabit oranlar kullanır (oranları dönem dönem değiştirmez);
338
+ açık yaş grubu için Preston ve ark. (2001) yaklaşımı uygulanır.
339
+ - `srb=1.05` (100 kıza 105 erkek) genel biyolojik varsayılandır; bölgesel değer
340
+ için TÜİK doğum istatistiklerini kullanın. Örnek kohort verileri uydurmadır.
341
+ - Lojistik en küçük kareler çözümü sayısaldır; doygunluk eğilimi zayıf
342
+ verilerde `K` çok belirsizdir, sonucu fiziksel kapasiteyle (plan nüfusu)
343
+ karşılaştırın.
344
+
345
+ ## Geliştirme
346
+
347
+ ```bash
348
+ pip install -e ".[dev]"
349
+ pytest --cov=tr_nufus
350
+ ruff check . && ruff format --check src tests && mypy src
351
+ ```
352
+
353
+ Testler ağ kullanmaz; elle hesaplanmış örnekler, tam lojistik / üstel / ikinci
354
+ derece eğrilerin geri elde edilmesi ve TÜİK bültenlerindeki artış hızlarıyla
355
+ doğrulama içerir.
356
+
357
+ ## Lisans
358
+
359
+ MIT © 2026 Yusuf Eminoğlu. Bkz. [LICENSE](LICENSE). Atıf için
360
+ [CITATION.cff](CITATION.cff).
361
+
362
+ ## Academic citation
363
+
364
+ ```bibtex
365
+ @software{eminoglu_tr_nufus,
366
+ author = {Eminoğlu, Yusuf},
367
+ title = {tr-nufus},
368
+ year = {2026},
369
+ version = {0.1.0},
370
+ url = {https://github.com/YusufEminoglu/tr_nufus_sdk}
371
+ }
372
+ ```
373
+
374
+ İletişim: geospacephilo@gmail.com