Closed nikhilwoodruff closed 2 years ago
This ensures IndividualSim.deriv always operates on the given entities correctly.
IndividualSim.deriv
When using deriv where wrt and target have different entities, you'll need to specify a target entity for at least the wrt variable. For example:
deriv
wrt
target
sim = IndividualSim(year=2022) sim.add_person(name="adult", age=30, employment_income=250 * 12) sim.add_person(name="child", age=10) sim.add_spm_unit( name="spm_unit", members=["adult", "child"], is_tanf_enrolled=enrolled ) sim.add_household( name="household", members=["adult", "child"], state_code=state_code ) sim.vary("employment_income", max=1000 * 12, step=120) sim.deriv("tanf", "employment_income", wrt_target="adult") # <- I've added "adult". I could've instead added "spm_unit".
This ensures
IndividualSim.deriv
always operates on the given entities correctly.When using
deriv
wherewrt
andtarget
have different entities, you'll need to specify a target entity for at least thewrt
variable. For example: