Skip to content

Replace SOEP 'not applicable' codes with 0 for income/wealth variables#75

Open
MImmesberger wants to merge 7 commits intofix-hh-id-ppathlfrom
fix-not-applicable
Open

Replace SOEP 'not applicable' codes with 0 for income/wealth variables#75
MImmesberger wants to merge 7 commits intofix-hh-id-ppathlfrom
fix-not-applicable

Conversation

@MImmesberger
Copy link
Copy Markdown
Collaborator

@MImmesberger MImmesberger commented Mar 31, 2026

Summary

  • Add _replace_not_applicable_with(series, value) utility in data_manipulator.py that maps SOEP code -2 ("trifft nicht zu" / "does not apply") to a concrete value (typically 0) for income variables, while preserving genuinely missing codes (-1, -3 to -9) as NA
  • Apply to all income, pension, benefit, transfer, and cost variables across 6 clean modules:
    • pequiv.py: HH income, all pension types, benefits (kindergeld, wohngeld, ALG, etc.), transfers (unterhalt, BAföG), labor earnings, bonuses, costs
    • pgen.py: gross/net labor income
    • pl.py: net income average, maternity benefit, child support, disability degree
    • hgen.py: heating costs
    • hl.py: kindergeld, kinderzuschlag, wohngeld, ALG2, grundsicherung im alter
    • kidlong.py: childcare/school costs
    • pkal.py: unemployment months

Motivation

Previously, all SOEP negative codes (-1 through -8) were uniformly converted to NA. This lost the distinction between "no answer" (genuinely missing) and "does not apply" (code -2, logically means 0 for income).

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@MImmesberger MImmesberger changed the base branch from main to fix-hh-id-ppathl March 31, 2026 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant