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>
  • 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

      public BenefitUnit(BenefitUnit originalBenefitUnit, boolean regressionModel)
    • BenefitUnit

      public BenefitUnit(Long id, long statSeed)
    • BenefitUnit

      public BenefitUnit(Person person, long statSeed)
    • BenefitUnit

      public BenefitUnit(Person p1, Person p2)
    • BenefitUnit

      public BenefitUnit(BenefitUnit originalBenefitUnit, long benefitUnitInnov, SampleEntry sampleEntry)
  • Method Details

    • setWealthNonPensionForPopulationInitialization

      public void setWealthNonPensionForPopulationInitialization(WealthNonPension wealthNonPension)
      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

      public void onEvent(Enum<?> type)
      Specified by:
      onEvent in interface microsim.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

      public int getIntValue(Enum<?> variableID)
    • getDoubleValue

      public double getDoubleValue(Enum<?> variableID)
      Specified by:
      getDoubleValue in interface microsim.statistics.IDoubleSource
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(BenefitUnit benefitUnit)
      Specified by:
      compareTo in interface Comparable<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

      public void setNonPensionWealth(Person person)
    • getWealthNonPensValue

      public double getWealthNonPensValue(boolean throwError)
    • setWealthTotValue

      public void setWealthTotValue(Double wealthTotValue)
    • getWealthPensValue

      public double getWealthPensValue()
    • getWealthPensValue

      public double getWealthPensValue(boolean throwError)
    • getWealthNonPensValue

      public double getWealthNonPensValue()
    • setWealthPensValue

      public void setWealthPensValue(Double wealthPensValue)
    • getWealthPrptyValue

      public double getWealthPrptyValue()
    • getWealthPrptyValue

      public double getWealthPrptyValue(boolean throwError)
    • setWealthPrptyValue

      public void setWealthPrptyValue(Double wealthPrptyValue)
    • getWealthMortgageDebtValue

      public double getWealthMortgageDebtValue()
    • getWealthMortgageDebtValue

      public double getWealthMortgageDebtValue(boolean throwError)
    • getWealthUnsecuredDebtLowValue

      public double getWealthUnsecuredDebtLowValue()
    • getWealthUnsecuredDebtLowValue

      public double getWealthUnsecuredDebtLowValue(boolean throwError)
    • setWealthUnsecuredDebtLowValue

      public void setWealthUnsecuredDebtLowValue(Double wealthUnsecuredDebtLowValue)
    • getWealthUnsecuredDebtHighValue

      public double getWealthUnsecuredDebtHighValue()
    • getWealthUnsecuredDebtHighValue

      public double getWealthUnsecuredDebtHighValue(boolean throwError)
    • setWealthUnsecuredDebtHighValue

      public void setWealthUnsecuredDebtHighValue(Double wealthUnsecuredDebtHighValue)
    • getXChildCareWeek

      public double getXChildCareWeek()
    • getXChildCareWeek

      public double getXChildCareWeek(boolean throwError)
    • getXCareWeek

      public double getXCareWeek()
    • getXCareWeek

      public double getXCareWeek(boolean throwError)
    • getHousehold

      public Household getHousehold()
    • setHousehold

      public void setHousehold(Household newHousehold)
    • getRegion

      public Region getRegion()
    • setRegion

      public void setRegion(Region region)
    • getWeight

      public double getWeight()
      Specified by:
      getWeight in interface microsim.agent.Weight
    • getChildren

      public Set<Person> getChildren()
    • getIdFemale

      public Long getIdFemale()
    • getNumberChildrenAll

      public int getNumberChildrenAll()
    • getNumberChildren

      public int getNumberChildren(int age)
    • getNumberChildren0to2

      public Integer getNumberChildren0to2()
    • getNumberChildren

      public int getNumberChildren(int minAge, int maxAge)
    • getIndicatorChildren

      public Indicator getIndicatorChildren(int minAge, int maxAge)
      Whether the Person has children in the given age range (both ends included).
    • getIndicatorChildren0to3

      public Indicator getIndicatorChildren0to3()
    • getIndicatorChildren4to12

      public Indicator getIndicatorChildren4to12()
    • getNumberChildrenAllL1

      public Integer getNumberChildrenAllL1()
    • getNumberChildren02L1

      public Integer getNumberChildren02L1()
    • getDem0to3L1

      public Indicator getDem0to3L1()
    • getDem4to12L1

      public Indicator getDem4to12L1()
    • getEquivalisedDisposableIncomeYearly

      public double getEquivalisedDisposableIncomeYearly()
    • getYDispEquivYear

      public Double 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

      public Integer getYPvrtyFlagL1()
    • getYDispEquivYearL1

      public Double getYDispEquivYearL1()
    • setYPvrtyFlag

      public void setYPvrtyFlag(Integer yPvrtyFlag)
    • getDisposableIncomeMonthlyNoNull

      public Double getDisposableIncomeMonthlyNoNull()
    • getDisposableIncomeMonthly

      public Double getDisposableIncomeMonthly()
    • getYDispMonth

      public Double getYDispMonth()
    • getGrossIncomeMonthly

      public Double getGrossIncomeMonthly()
    • getBenefitsReceivedPerMonth

      public Double getBenefitsReceivedPerMonth()
    • getReceivedUC

      public Integer getReceivedUC()
    • setReceivedUC

      public void setReceivedUC(Integer yBenUCReceivedFlag)
    • getReceivedLegacyBenefits

      public Integer getReceivedLegacyBenefits()
    • setReceivedLegacyBenefits

      public void setReceivedLegacyBenefits(Integer yBenLegacyReceivedFlag)
    • setI_demOccupancy

      public void setI_demOccupancy(Occupancy occupancy)
    • getOccupancy

      public Occupancy getOccupancy()
    • getCoupleDummy

      public int getCoupleDummy()
    • getCoupleBoolean

      public boolean getCoupleBoolean()
    • getId

      public long getId()
    • getYHhQuintilesMonthC5

      public Ydses_c5 getYHhQuintilesMonthC5()
    • getYHhQuintilesMonthC5L1

      public Ydses_c5 getYHhQuintilesMonthC5L1()
    • getI_yNonBenHhGrossAsinhNoNull

      public double getI_yNonBenHhGrossAsinhNoNull()
    • getI_yNonBenHhGrossAsinh

      public double getI_yNonBenHhGrossAsinh()
    • setI_yNonBenHhGrossAsinh

      public void setI_yNonBenHhGrossAsinh(double val)
    • getDemCompHhC4

      public Dhhtp_c4 getDemCompHhC4()
    • getDemCompHhC4L1

      public Dhhtp_c4 getDemCompHhC4L1()
    • isHousingOwned

      public boolean isHousingOwned()
    • getWealthPrptyFlagL1

      public Boolean 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

      public Person getRefPerson()
    • getRefPersonForDecisions

      public Person 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

      public void setI_eduHighestC4(Education edu)
    • setI_labHrsWork1Week

      public void setI_labHrsWork1Week(Integer hours)
    • setI_labHrsWork2Week

      public void setI_labHrsWork2Week(Integer hours)
    • setI_demYear

      public void setI_demYear(Integer year)
    • getYear

      public int getYear()
    • getTaxDbDonorId

      public long getTaxDbDonorId()
    • getTaxDbMatch

      public Match getTaxDbMatch()
    • getMembers

      public Set<Person> getMembers()
    • setProcessedId

      public void setProcessedId(long id)
    • getSeed

      public long getSeed()
    • getIdBuOriginal

      public long getIdBuOriginal()
    • getIdHhOriginal

      public long getIdHhOriginal()
    • getFemale

      public Person getFemale()
    • getMale

      public Person getMale()
    • removeMember

      public void removeMember(Person member)
    • 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

      public SimPathsCollector getCollector()
    • getWealthNonPension

      public WealthNonPension getWealthNonPension()