Class BenefitUnit
java.lang.Object
simpaths.model.BenefitUnit
- All Implemented Interfaces:
Comparable<BenefitUnit>, microsim.agent.Weight, microsim.event.EventListener, microsim.statistics.IDoubleSource
@Entity
public class BenefitUnit
extends Object
implements microsim.event.EventListener, microsim.statistics.IDoubleSource, microsim.agent.Weight, Comparable<BenefitUnit>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enum -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCONSTRUCTOR FOR OBJECT USED ONLY TO INTERACT WITH REGRESSION MODELSBenefitUnit(boolean regressionModel) BenefitUnit(long id) BenefitUnit(Long id, long statSeed) BenefitUnit(BenefitUnit originalBenefitUnit, boolean regressionModel) BenefitUnit(BenefitUnit originalBenefitUnit, long benefitUnitInnov, SampleEntry sampleEntry) BenefitUnit(Person person, long statSeed) BenefitUnit(Person p1, Person p2) -
Method Summary
Modifier and TypeMethodDescriptiondoubleasinh(double xx) protected voiddoubleprotected voidintcompareTo(BenefitUnit benefitUnit) voidatRiskOfWork() depends on dag, les_c4, dlltsd, and inverseMillsRatio — none of these should change fixed-costs that are adjusted inside the alignment loop. - caching it is safe and removes a lot of repeated work.booleanLinkedHashSet<org.apache.commons.collections4.keyvalue.MultiKey<Labour>> This method returns all possible combinations of male's and female's hours of workdoubledoublebooleanbooleanintArrayList<org.apache.commons.lang3.tuple.Triple<Les_c7_covid, Double, Integer>> ArrayList<org.apache.commons.lang3.tuple.Triple<Les_c7_covid, Double, Integer>> doubledoublegetDoubleValue(Enum<?> variableID) doubledoubledoubledoubledoublelonggetId()longlonggetIndicatorChildren(int minAge, int maxAge) Whether the Person has children in the given age range (both ends included).intgetIntValue(Enum<?> variableID) doublemicrosim.data.db.PanelEntityKeygetKey()Returns a defensive copy of the field.getMale()intdoubledoubleintgetNumberChildren(int age) intgetNumberChildren(int minAge, int maxAge) intintgetNumberChildrenByAge(int age) doubledoubleintdoublelonggetSeed()intgetSize()longdoubledoublegetWealthMortgageDebtValue(boolean throwError) doubledoublegetWealthNonPensValue(boolean throwError) doubledoublegetWealthPensValue(boolean throwError) doubledoubleintdoubledoublegetWealthPrptyValue(boolean throwError) doubledoublegetWealthTotValue(boolean throwError) doubleClaims and minors' trusts appear in net wealth, but are not consumption resources.doublegetWealthTotValueForDecisions(boolean throwError) doubledoublegetWealthUnsecuredDebtHighValue(boolean throwError) doubledoublegetWealthUnsecuredDebtLowValue(boolean throwError) doubledoubledoublegetXCareWeek(boolean throwError) doubledoublegetXChildCareWeek(boolean throwError) doubledoublegetXDiscConsumptionAnnual(boolean throwError) This year's equivalised disposable income, or null if it has not been calculated yet (no -9999.99 placeholder).intgetYear()intinthashCode()protected voidprotected voidbooleanbooleanvoidvoidremoveMember(Person member) protected voidstatic voidsetBenefitUnitIdCounter(long id) voidsetHousehold(Household newHousehold) voidsetI_demOccupancy(Occupancy occupancy) voidsetI_demYear(Integer year) voidvoidsetI_labHrsWork1Week(Integer hours) voidsetI_labHrsWork2Week(Integer hours) voidsetI_yNonBenHhGrossAsinh(double val) voidmethod to set yInvestAnnual (BenefitUnit) and yCapitalPersMonth (Person)voidsetNetFinancialWealthDecile(int decile) voidsetNonPensionWealth(Person person) voidsetPrivateIncomeDecile(int decile) voidmethod to set yPensionAnnual (BenefitUnit) and yPensPersGrossMonth (Person)voidsetProcessedId(long id) voidsetReceivedLegacyBenefits(Integer yBenLegacyReceivedFlag) voidsetReceivedUC(Integer yBenUCReceivedFlag) voidvoidvoidvoidsetWealthNonPensionForPopulationInitialization(WealthNonPension wealthNonPension) Attaches wealth state prepared by the population-initialisation module.voidsetWealthPensValue(Double wealthPensValue) voidsetWealthPrivateIncomeMonthly(double monthlyIncome) voidsetWealthPrivateIncomeQuintile(int quintile) voidsetWealthPrptyFlag(boolean wealthPrptyFlag) voidsetWealthPrptyValue(Double wealthPrptyValue) voidsetWealthTotValue(Double wealthTotValue) voidsetWealthUnsecuredDebtHighValue(Double wealthUnsecuredDebtHighValue) voidsetWealthUnsecuredDebtLowValue(Double wealthUnsecuredDebtLowValue) voidsetYPvrtyFlag(Integer yPvrtyFlag) voidprotected voidprotected voidvoidvoidvoidvoidPrecomputes and caches tax/benefit evaluations for all feasible discrete labour options.protected voidMain labour-supply + income update for a benefit unit.protected voidvoidvoidvoidvoidvoidvoidPrecomputes and caches utility regression scores excluding fixed costs.protected void
-
Field Details
-
benefitUnitIdCounter
public static long benefitUnitIdCounter
-
-
Constructor Details
-
BenefitUnit
public BenefitUnit()CONSTRUCTOR FOR OBJECT USED ONLY TO INTERACT WITH REGRESSION MODELS -
BenefitUnit
public BenefitUnit(long id) -
BenefitUnit
public BenefitUnit(boolean regressionModel) -
BenefitUnit
-
BenefitUnit
-
BenefitUnit
-
BenefitUnit
-
BenefitUnit
-
-
Method Details
-
setWealthNonPensionForPopulationInitialization
Attaches wealth state prepared by the population-initialisation module. Regression scoring and residual-state construction deliberately live in the wealth component rather than in this entity. -
onEvent
- Specified by:
onEventin interfacemicrosim.event.EventListener
-
initializeFields
protected void initializeFields() -
updateAttributes
protected void updateAttributes() -
updateWealth
protected void updateWealth() -
updatePensionWealth
public void updatePensionWealth() -
updateNonPensionWealth
public void updateNonPensionWealth() -
updateHousingWealth
public void updateHousingWealth() -
updateNetFinancialAssetsValue
public void updateNetFinancialAssetsValue() -
updateUnsecuredDebt
public void updateUnsecuredDebt() -
updateTotalWealth
public void updateTotalWealth() -
getPerAdultWealthAccrual
public double getPerAdultWealthAccrual() -
resetLabourStates
protected void resetLabourStates() -
findPossibleLabourCombinations
public LinkedHashSet<org.apache.commons.collections4.keyvalue.MultiKey<Labour>> findPossibleLabourCombinations()This method returns all possible combinations of male's and female's hours of work- Returns:
-
setReceivesBenefitsFlag
public void setReceivesBenefitsFlag() -
setReceivesBenefitsFlagUCNonUC
public void setReceivesBenefitsFlagUCNonUC() -
updateDisposableIncomeIfNotAtRiskOfWork
protected void updateDisposableIncomeIfNotAtRiskOfWork() -
updateMonthlyLabourSupplyCovid19
protected void updateMonthlyLabourSupplyCovid19() -
chooseRandomMonthlyOutcomeCovid19
protected void chooseRandomMonthlyOutcomeCovid19() -
computeAtRiskOfWorkFlags
public void computeAtRiskOfWorkFlags()atRiskOfWork() depends on dag, les_c4, dlltsd, and inverseMillsRatio — none of these should change fixed-costs that are adjusted inside the alignment loop. - caching it is safe and removes a lot of repeated work. -
updateLabourChoices
public void updateLabourChoices()Precomputes and caches tax/benefit evaluations for all feasible discrete labour options. Resets labour states, updates non-labour income for consistency, and then (if cache is stale) rebuilds: - the feasible labour combinations, and - the mapping from labour-pairs to evaluated disposable/gross income, benefits and tax DB match. The cache is intended for the non-intertemporal discrete-choice branch only; when IO is enabled - this method exits early. -
updateUtilityRegressionScoresWithoutFC
public void updateUtilityRegressionScoresWithoutFC()Precomputes and caches utility regression scores excluding fixed costs. This is done to speed up employment alignment by avoiding repeated utility evaluation. Called once before the alignment loop and reused across alignment iterations. -
updateFixedCostsAndLabour
public void updateFixedCostsAndLabour() -
updateLabourSupplyAndIncome
protected void updateLabourSupplyAndIncome()Main labour-supply + income update for a benefit unit. If intertemporal optimisations (IO) are enabled, derives (continuous) hours from the IO grids, converts to discrete labour states, computes labour + non-labour income, and evaluates taxes/ benefits once via taxWrapper. If IO is disabled, enumerates all feasible discrete labour options (single or couple), evaluates taxes/benefits for each, computes regression utilities, samples a labour choice, applies optional childcare/social care costs, and stores the chosen disposable/gross income, benefits and tax DB match. Always finishes by recalculating BU/occupant income aggregates via calculateBUIncome(). -
calculateBUIncome
protected void calculateBUIncome() -
updateIncomeQuintile
public void updateIncomeQuintile() -
getSize
public int getSize() -
updateActivityOfPersonsWithinBenefitUnit
public void updateActivityOfPersonsWithinBenefitUnit() -
getIntValue
-
getDoubleValue
- Specified by:
getDoubleValuein interfacemicrosim.statistics.IDoubleSource
-
equals
-
hashCode
-
compareTo
- Specified by:
compareToin interfaceComparable<BenefitUnit>
-
getAtRiskOfWork
public boolean getAtRiskOfWork() -
fracEmployed
public double fracEmployed() -
isEmployed
public boolean isEmployed() -
homeownership
protected void homeownership() -
calculateEquivalisedDisposableIncomeYearly
public double calculateEquivalisedDisposableIncomeYearly() -
getKey
public microsim.data.db.PanelEntityKey getKey()Returns a defensive copy of the field. The caller of this method can do anything they want with the returned Key object, without affecting the internals of this class in any way. -
getWealthTotValue
public double getWealthTotValue() -
getWealthTotValue
public double getWealthTotValue(boolean throwError) -
getWealthTotValueForDecisions
public double getWealthTotValueForDecisions()Claims and minors' trusts appear in net wealth, but are not consumption resources. -
getWealthTotValueForDecisions
public double getWealthTotValueForDecisions(boolean throwError) -
setNonPensionWealth
-
getWealthNonPensValue
public double getWealthNonPensValue(boolean throwError) -
setWealthTotValue
-
getWealthPensValue
public double getWealthPensValue() -
getWealthPensValue
public double getWealthPensValue(boolean throwError) -
getWealthNonPensValue
public double getWealthNonPensValue() -
setWealthPensValue
-
getWealthPrptyValue
public double getWealthPrptyValue() -
getWealthPrptyValue
public double getWealthPrptyValue(boolean throwError) -
setWealthPrptyValue
-
getWealthMortgageDebtValue
public double getWealthMortgageDebtValue() -
getWealthMortgageDebtValue
public double getWealthMortgageDebtValue(boolean throwError) -
getWealthUnsecuredDebtLowValue
public double getWealthUnsecuredDebtLowValue() -
getWealthUnsecuredDebtLowValue
public double getWealthUnsecuredDebtLowValue(boolean throwError) -
setWealthUnsecuredDebtLowValue
-
getWealthUnsecuredDebtHighValue
public double getWealthUnsecuredDebtHighValue() -
getWealthUnsecuredDebtHighValue
public double getWealthUnsecuredDebtHighValue(boolean throwError) -
setWealthUnsecuredDebtHighValue
-
getXChildCareWeek
public double getXChildCareWeek() -
getXChildCareWeek
public double getXChildCareWeek(boolean throwError) -
getXCareWeek
public double getXCareWeek() -
getXCareWeek
public double getXCareWeek(boolean throwError) -
getHousehold
-
setHousehold
-
getRegion
-
setRegion
-
getWeight
public double getWeight()- Specified by:
getWeightin interfacemicrosim.agent.Weight
-
getChildren
-
getIdFemale
-
getNumberChildrenAll
public int getNumberChildrenAll() -
getNumberChildren
public int getNumberChildren(int age) -
getNumberChildren0to2
-
getNumberChildren
public int getNumberChildren(int minAge, int maxAge) -
getIndicatorChildren
Whether the Person has children in the given age range (both ends included). -
getIndicatorChildren0to3
-
getIndicatorChildren4to12
-
getNumberChildrenAllL1
-
getNumberChildren02L1
-
getDem0to3L1
-
getDem4to12L1
-
getEquivalisedDisposableIncomeYearly
public double getEquivalisedDisposableIncomeYearly() -
getYDispEquivYear
This year's equivalised disposable income, or null if it has not been calculated yet (no -9999.99 placeholder). -
getYPvrtyFlag
public int getYPvrtyFlag() -
getYPvrtyFlagL1
-
getYDispEquivYearL1
-
setYPvrtyFlag
-
getDisposableIncomeMonthlyNoNull
-
getDisposableIncomeMonthly
-
getYDispMonth
-
getGrossIncomeMonthly
-
getBenefitsReceivedPerMonth
-
getReceivedUC
-
setReceivedUC
-
getReceivedLegacyBenefits
-
setReceivedLegacyBenefits
-
setI_demOccupancy
-
getOccupancy
-
getCoupleDummy
public int getCoupleDummy() -
getCoupleBoolean
public boolean getCoupleBoolean() -
getId
public long getId() -
getYHhQuintilesMonthC5
-
getYHhQuintilesMonthC5L1
-
getI_yNonBenHhGrossAsinhNoNull
public double getI_yNonBenHhGrossAsinhNoNull() -
getI_yNonBenHhGrossAsinh
public double getI_yNonBenHhGrossAsinh() -
setI_yNonBenHhGrossAsinh
public void setI_yNonBenHhGrossAsinh(double val) -
getDemCompHhC4
-
getDemCompHhC4L1
-
isHousingOwned
public boolean isHousingOwned() -
getWealthPrptyFlagL1
-
setWealthPrptyFlag
public void setWealthPrptyFlag(boolean wealthPrptyFlag) -
getCovid19MonthlyStateAndGrossIncomeAndWorkHoursTripleFemale
public ArrayList<org.apache.commons.lang3.tuple.Triple<Les_c7_covid, Double, Integer>> getCovid19MonthlyStateAndGrossIncomeAndWorkHoursTripleFemale() -
getCovid19MonthlyStateAndGrossIncomeAndWorkHoursTripleMale
public ArrayList<org.apache.commons.lang3.tuple.Triple<Les_c7_covid, Double, Integer>> getCovid19MonthlyStateAndGrossIncomeAndWorkHoursTripleMale() -
getDisposableIncomeMonthlyUpratedToBasePriceYear
public double getDisposableIncomeMonthlyUpratedToBasePriceYear() -
getAdjustedDisposableIncomeMonthlyUpratedToBasePriceYear
public double getAdjustedDisposableIncomeMonthlyUpratedToBasePriceYear() -
getNonDiscretionaryExpenditureMonthlyUpratedToBasePriceYear
public double getNonDiscretionaryExpenditureMonthlyUpratedToBasePriceYear() -
getRefPerson
-
getRefPersonForDecisions
-
getHealthValForBehaviour
public double getHealthValForBehaviour() -
getRegionIndex
public double getRegionIndex() -
getNumberChildrenByAge
public int getNumberChildrenByAge(int age) -
setPrivatePensionIncomeAnnual
public void setPrivatePensionIncomeAnnual()method to set yPensionAnnual (BenefitUnit) and yPensPersGrossMonth (Person) -
setInvestmentIncomeAnnual
public void setInvestmentIncomeAnnual()method to set yInvestAnnual (BenefitUnit) and yCapitalPersMonth (Person) -
getInvestmentIncomeAnnual
public double getInvestmentIncomeAnnual() -
getPensionIncomeAnnual
public double getPensionIncomeAnnual() -
getXDiscConsumptionAnnual
public double getXDiscConsumptionAnnual() -
getXDiscConsumptionAnnual
public double getXDiscConsumptionAnnual(boolean throwError) -
getEquivalisedWeight
public double getEquivalisedWeight() -
asinh
public double asinh(double xx) -
setI_eduHighestC4
-
setI_labHrsWork1Week
-
setI_labHrsWork2Week
-
setI_demYear
-
getYear
public int getYear() -
getTaxDbDonorId
public long getTaxDbDonorId() -
getTaxDbMatch
-
getMembers
-
setProcessedId
public void setProcessedId(long id) -
getSeed
public long getSeed() -
getIdBuOriginal
public long getIdBuOriginal() -
getIdHhOriginal
public long getIdHhOriginal() -
getFemale
-
getMale
-
removeMember
-
setBenefitUnitIdCounter
public static void setBenefitUnitIdCounter(long id) -
getNetFinancialWealthForRanking
public double getNetFinancialWealthForRanking() -
setNetFinancialWealthDecile
public void setNetFinancialWealthDecile(int decile) -
setPrivateIncomeDecile
public void setPrivateIncomeDecile(int decile) -
setWealthPrivateIncomeQuintile
public void setWealthPrivateIncomeQuintile(int quintile) -
setWealthPrivateIncomeMonthly
public void setWealthPrivateIncomeMonthly(double monthlyIncome) -
getWealthPrivateIncomeMonthly
public double getWealthPrivateIncomeMonthly() -
getWealthPrivateIncomeMonthlyL1
public double getWealthPrivateIncomeMonthlyL1() -
getNetFinancialWealthDecile
public int getNetFinancialWealthDecile() -
getPrivateIncomeDecile
public int getPrivateIncomeDecile() -
getWealthPrivateIncomeQuintile
public int getWealthPrivateIncomeQuintile() -
getCollector
-
getWealthNonPension
-