Skip to content

Commit

Permalink
Added initial age split functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
AHsu98 committed Mar 28, 2024
1 parent 8531b1a commit a5d6a55
Show file tree
Hide file tree
Showing 8 changed files with 558 additions and 3 deletions.
Empty file modified src/pydisagg/DisaggModel.py
100644 → 100755
Empty file.
Empty file modified src/pydisagg/ParameterTransformation.py
100644 → 100755
Empty file.
Empty file modified src/pydisagg/__init__.py
100644 → 100755
Empty file.
521 changes: 521 additions & 0 deletions src/pydisagg/age_split/age_split.py

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions src/pydisagg/age_split/age_var.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import numpy as np
import pandas as pd

age_group_id = [2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19, 20, 30, 31, 32, 235]
age_group_years_start = [0, 0.01917808, 0.07671233, 1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95]
age_group_years_end = [0.01917808, 0.07671233, 1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90,95, 125]
#TODO Handle low age groups more elegantly, we're just doing 1 year buckets for now, we should have an exception for age groups under 1, and explicitly model those as single

age_mid = (np.array(age_group_years_start) + np.array(age_group_years_end)) / 2

age_id_map = pd.DataFrame({
'age_group_id': age_group_id,
'age_group_years_start': age_group_years_start,
'age_group_years_end': age_group_years_end,
'age_mid': age_mid
})

rename_dict_dis = {
"year_start": "year_start",
"year_end": "year_end",
"location_id": "location_id",
"sex": "sex_id",
"age_start": "original_data_age_start",
"age_end": "original_data_age_end",
"mean": "value",
"standard_error": "SE"
}
match_cols = [
"row_id",
"year_start",
"year_end",
"original_data_age_start",
"original_data_age_end",
"sex_id",
"value",
"SE",
]
Empty file modified src/pydisagg/disaggregate.py
100644 → 100755
Empty file.
3 changes: 0 additions & 3 deletions src/pydisagg/models.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ def fit_beta(
observed_total: float,
rate_pattern: NDArray,
bucket_populations: NDArray,
lower_guess: Optional[float] = -50,
upper_guess: Optional[float] = 50,
verbose: Optional[int] = 0
) -> None:
"""
Custom fit_beta for this model, as we can do it without rootfinding.
Expand Down
Empty file modified src/pydisagg/transformations.py
100644 → 100755
Empty file.

0 comments on commit a5d6a55

Please sign in to comment.