Skip to content

Commit d05b442

Browse files
Fix CPP formula, values, references, and rebase on master
- Cap benefit at maximum_monthly: min_(avg * factor, max) * 12 - Extract hard-coded 40 into max_contributory_years parameter - Fix 2025 average monthly: $844.53 → $803.76 per canada.ca - Add reference URLs to all 3 variable files - Move tests to tests/gov/cra/benefits/cpp/ (correct path) - Add changelog fragment - Update parameter descriptions to active-voice format Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 838054e commit d05b442

9 files changed

Lines changed: 43 additions & 33 deletions

File tree

changelog.d/525.added.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Added CPP retirement pension calculation with eligibility, contribution history, and benefit parameters.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
description: Average monthly CPP retirement pension at age 65
1+
description: The Canada Pension Plan applies this average monthly amount for retirement pension benefits at age 65.
22
values:
33
2020-01-01: 710.41
44
2021-01-01: 702.77
55
2022-01-01: 727.61
66
2023-01-01: 758.32
77
2024-01-01: 816.52
8-
2025-01-01: 844.53
8+
2025-01-01: 803.76
99
metadata:
1010
unit: currency-CAD
1111
period: month
1212
label: CPP average monthly retirement pension
1313
reference:
1414
- title: CPP retirement pension amount
15-
href: https://www.canada.ca/en/services/benefits/publicpensions/cpp/cpp-benefit/amount.html
15+
href: https://www.canada.ca/en/services/benefits/publicpensions/cpp/cpp-benefit/amount.html
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
description: Minimum age for CPP retirement pension eligibility
1+
description: The Canada Pension Plan requires this minimum age for retirement pension eligibility.
22
values:
33
2020-01-01: 60
44
metadata:
@@ -7,4 +7,4 @@ metadata:
77
label: CPP retirement pension eligibility age
88
reference:
99
- title: CPP retirement pension eligibility
10-
href: https://www.canada.ca/en/services/benefits/publicpensions/cpp/cpp-benefit/eligibility.html
10+
href: https://www.canada.ca/en/services/benefits/publicpensions/cpp/cpp-benefit/eligibility.html
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
description: The Canada Pension Plan sets this as the maximum number of contributory years used to calculate the retirement pension.
2+
values:
3+
1966-01-01: 40
4+
metadata:
5+
unit: year
6+
period: year
7+
label: CPP maximum contributory years
8+
reference:
9+
- title: Canada Pension Plan (R.S.C., 1985, c. C-8)
10+
href: https://laws-lois.justice.gc.ca/eng/acts/c-8/page-5.html

policyengine_canada/parameters/gov/cra/benefits/cpp/retirement/maximum_monthly.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
description: Maximum monthly CPP retirement pension at age 65
1+
description: The Canada Pension Plan sets this maximum monthly amount for retirement pension benefits at age 65.
22
values:
33
2020-01-01: 1_175.83
44
2021-01-01: 1_203.75
@@ -12,4 +12,4 @@ metadata:
1212
label: CPP maximum monthly retirement pension
1313
reference:
1414
- title: CPP retirement pension amount
15-
href: https://www.canada.ca/en/services/benefits/publicpensions/cpp/cpp-benefit/amount.html
15+
href: https://www.canada.ca/en/services/benefits/publicpensions/cpp/cpp-benefit/amount.html

policyengine_canada/tests/benefits/cpp/cpp_retirement_pension.yaml renamed to policyengine_canada/tests/gov/cra/benefits/cpp/cpp_retirement_pension.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
cpp_years_of_contribution: 45
4242
output:
4343
# Capped at 40 years = full average benefit
44-
# $844.53 * 12 = $10,134.36
45-
cpp_retirement_pension: 10_134.36
44+
# $803.76 * 12 = $9,645.12
45+
cpp_retirement_pension: 9_645.12
4646

4747
- name: Minimum contribution scenario
4848
period: 2024
@@ -52,4 +52,4 @@
5252
output:
5353
# 1/40 years = 2.5% of average benefit
5454
# $816.52 * 0.025 * 12 = $244.956
55-
cpp_retirement_pension: 244.956
55+
cpp_retirement_pension: 244.956

policyengine_canada/variables/gov/cra/benefits/cpp/cpp_retirement_eligible.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@ class cpp_retirement_eligible(Variable):
77
label = "Eligible for CPP retirement pension"
88
definition_period = YEAR
99
documentation = "Whether person is eligible for CPP retirement pension"
10-
10+
reference = "https://www.canada.ca/en/services/benefits/publicpensions/cpp/cpp-benefit/eligibility.html"
11+
1112
def formula(person, period, parameters):
1213
p = parameters(period).gov.cra.benefits.cpp.retirement
13-
14+
1415
# Check age requirement (60+)
1516
age = person("age", period)
1617
meets_age = age >= p.eligibility_age
17-
18+
1819
# Check contribution requirement (simplified - at least 1 year)
1920
years_contributed = person("cpp_years_of_contribution", period)
2021
has_contributions = years_contributed > 0
21-
22-
return meets_age & has_contributions
22+
23+
return meets_age & has_contributions

policyengine_canada/variables/gov/cra/benefits/cpp/cpp_retirement_pension.py

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,22 @@ class cpp_retirement_pension(Variable):
88
definition_period = YEAR
99
unit = CAD
1010
documentation = "Annual CPP retirement pension amount"
11-
11+
reference = "https://www.canada.ca/en/services/benefits/publicpensions/cpp/cpp-benefit/amount.html"
12+
1213
def formula(person, period, parameters):
1314
p = parameters(period).gov.cra.benefits.cpp.retirement
14-
15-
# Check eligibility
1615
eligible = person("cpp_retirement_eligible", period)
17-
18-
# Simplified calculation based on years of contribution
19-
# Use average between 0 and maximum based on contribution years
2016
years_contributed = person("cpp_years_of_contribution", period)
21-
22-
# Assume full contributions after 40 years
23-
contribution_factor = min_(years_contributed / 40, 1)
24-
25-
# Calculate monthly amount between 0 and maximum
26-
# For simplicity, use average as midpoint
27-
monthly_amount = contribution_factor * p.average_monthly
28-
29-
# Convert to annual
17+
18+
# Contribution factor: ratio of years contributed to maximum contributory period
19+
max_years = p.max_contributory_years
20+
contribution_factor = min_(years_contributed / max_years, 1)
21+
22+
# Scale average monthly by contribution factor, cap at maximum monthly
23+
monthly_amount = min_(
24+
p.average_monthly * contribution_factor,
25+
p.maximum_monthly,
26+
)
3027
annual_amount = monthly_amount * 12
31-
32-
return where(eligible, annual_amount, 0)
28+
29+
return where(eligible, annual_amount, 0)

policyengine_canada/variables/gov/cra/benefits/cpp/cpp_years_of_contribution.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ class cpp_years_of_contribution(Variable):
77
label = "Years of CPP contributions"
88
definition_period = YEAR
99
unit = "year"
10-
documentation = "Number of years person has contributed to CPP"
10+
documentation = "Number of years person has contributed to CPP"
11+
reference = "https://www.canada.ca/en/services/benefits/publicpensions/cpp/cpp-benefit/amount.html"

0 commit comments

Comments
 (0)