Aggregate SUM at a finer entity counts a group value once per unit inside it

Đang mở
#769 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
data

Hướng nghiên cứu

Start by reading Aggregate and ChangeAggregate and the map_to_entity behavior referenced in the issue, then compare it with the divide handling after issue #768. Reproduce the household-to-person SUM example and check crossing groups. The issue asks for a design decision between refusing SUM and splitting values by member share; done requires choosing and applying consistent behavior for both cases.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Aggregate and ChangeAggregate map a variable to the requested entity through map_to_entity's default how="sum". Mapping a group to the people or smaller groups inside it copies the group's value to each one, which a mean or a decile needs. A SUM then adds every copy, so

Aggregate(
    simulation=sim,
    variable="household_net_income",
    entity="person",
    aggregate_type=AggregateType.SUM,
)

counts each household's net income once per member. The overcount grows with the number of target units in each household, and on the certified US data (populace_us_2024, revision 0ff35303) the average household, weighted, holds:

Target entity Units
person 2.78
marital_unit 2.11
tax_unit 1.33
family 1.11
spm_unit 1.04

Crossing groups double-count too: when a source group's members sit in several target groups, sum gives the full value to each. In the same data, 697 of 79,729 tax units (0.60% household-weighted) span two or more families, at least one of which also holds another tax unit, and 1 tax unit spans two SPM units.

The country analyses here aggregate each program at its own entity and never take this path. A caller that names a finer entity does: policyengine-uk-chat's aggregate_result tool passes the entity its model picks (person, benunit or household) to Aggregate.

@anth-volk, should Aggregate refuse SUM when the target entity sits inside the variable's entity, or split the value by member share as divide does after #768? Crossing groups need the same choice.

Ngôn ngữ chính
Python
Star
10
Fork
10
Merge trung bình
2 ngày 2 giờ
Pull request đã merge (30 ngày)
16

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của PolicyEngine/policyengine.py

Tất cả issue của PolicyEngine/policyengine.py

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.