Skip to content

VEI observation-count ladder returns NaN for exactly 501 observations #371

Description

@nikhilsi

Line references below are to commit 7952236, in openavmkit/vertical_equity_study.py.

get_vertical_equity_scores picks the quantile group count at lines 27-32:

if 20 <= observation_count <= 50:
    percentile_group_count = 2
elif 51 <= observation_count <= 500:
    percentile_group_count = 4
elif observation_count > 501:
    percentile_group_count = 10
else:
    ...

The branches cover 20 to 50, 51 to 500, and greater than 501. A dataset with
exactly 501 observations falls through to the else branch and gets the
"fewer than 20 observations" NaN result, even though 500 and 502 both compute.

Repro: call get_vertical_equity_scores on a 501-row frame with valid sale and
valuation columns; vei is NaN. Repeat with 500 or 502 rows; it computes.

Minimal fix: elif observation_count > 500:.

Note: open PR #369 rewrites the qcut and tier logic in this same function. The
lines above are just outside that PR's hunks, but if #369 lands first this
one-character fix should be rebased onto its structure (or folded into it,
whichever the author prefers).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions