File tree Expand file tree Collapse file tree
policyengine_us_data/calibration Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -325,6 +325,29 @@ def _qrf_ss_shares(
325325 for sub in shares :
326326 shares [sub ] = np .where (total > 0 , shares [sub ] / total , 0.0 )
327327
328+ if (
329+ "age" in data
330+ and "social_security_retirement" in shares
331+ and "social_security_disability" in shares
332+ ):
333+ # Preserve QRF survivor/dependent predictions, but anchor the
334+ # retirement-vs-disability split to the same age rule as the fallback.
335+ age = data ["age" ][time_period ][:n_cps ][puf_has_ss ]
336+ is_old = age >= MINIMUM_RETIREMENT_AGE
337+ retirement_or_disability = (
338+ shares ["social_security_retirement" ] + shares ["social_security_disability" ]
339+ )
340+ shares ["social_security_retirement" ] = np .where (
341+ is_old ,
342+ retirement_or_disability ,
343+ 0.0 ,
344+ )
345+ shares ["social_security_disability" ] = np .where (
346+ is_old ,
347+ 0.0 ,
348+ retirement_or_disability ,
349+ )
350+
328351 del fitted , predictions
329352 gc .collect ()
330353
You can’t perform that action at this time.
0 commit comments