Skip to content

Add parameter extension functionality for uprating factors #391

@MaxGhenis

Description

@MaxGhenis

Summary

Currently, each country package (e.g., policyengine-us) needs to implement its own logic for extending uprating factors beyond the last year of official projections. This is a common pattern that would benefit from being standardized in policyengine-core.

Proposed Feature

Add a utility function to policyengine-core that can programmatically extend parameter values based on a growth rate calculated from the last years of available data. This would:

  1. Calculate growth rate from the last N years of projections
  2. Apply that growth rate to extend values through a specified end year
  3. Handle different period types (monthly, yearly, etc.)

Example Usage

from policyengine_core.parameters import extend_parameter_values

# Extend a parameter through 2100 using growth from last 2 years
extend_parameter_values(
    parameter=parameters.gov.some.uprating,
    last_projected_year=2034,
    end_year=2100,
    period_month=10,  # For October values
    period_day=1,
)

Benefits

  • Consistent approach across country packages
  • Easier maintenance when projection years change
  • Reduced code duplication
  • More robust than hardcoding future values in YAML files

Current Implementation

A working implementation can be found in this PR: PolicyEngine/policyengine-us#6384

The implementation includes:

  • A generic extend_parameter_values function
  • Support for different period types
  • Calculation of growth rates from existing data

Related Discussion

This came up during the review of extending US uprating factors through 2100 for long-term policy simulations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions