Simulator

This module runs the simulations.

CPR.simulator.simulate(job, common, prices)

Function that projects assets, RPPs and debts until the time of retirement.

Parameters
  • job (tuple(Hhold, int)) – instance of the class Hhold and simulation number

  • common (Common) – instance of the class Common

  • prices (Prices) – instance of the class Prices

Returns

dictionary containing households’ characteristics before and after retirement

Return type

dict

CPR.simulator.extract_time_series(sim, common, prices)

Function that attaches stochastic processes on asset returns to households.

Parameters
  • sim (int) – simulation number

  • common (Common) – instance of the class Common

  • prices (Prices) – instance of the class Prices

Returns

  • dict – returns on assets

  • dict – price-rent ratio

CPR.simulator.prepare_wages(p, sim, common, prices)

Function that attaches wage profiles to individuals.

Parameters
  • p (Person) – instance of the class Person

  • sim (int) – simulation number

  • common (Common) – instance of the class Common

  • prices (Prices) – instance of the class Prices

CPR.simulator.initialize_cpp_account(p, hh, common)

Function that creates a CPP/QPP account and enters past CPP/QPP contributions based on past wages.

Parameters
  • p (Person) – instance of the class Person

  • hh (Hhold) – household

  • common (Common) – instance of the class Common

CPR.simulator.update_ages(hh, year)

Function that computes age for a given year.

Parameters
  • hh (Hhold) – household

  • year (int) – year

CPR.simulator.update_debts(hh, year, sim, common, prices)

Function that updates debt payments and balances.

Parameters
  • hh (Hhold) – household

  • year (int) – year

  • sim (int) – simulation number

  • common (Common) – instance of the class Common

  • prices (Prices) – instance of the class Prices

CPR.simulator.adjust_contributions(hh, year, common, prices)

Function that adjusts contributions to all account types (RRSP, other registered, TFSA) and to pensions plans (DC and DB RPPs) so as to respect available contribution rooms.

Parameters
  • hh (Hhold) – household

  • year (int) – year

  • common (Common) – instance of the class Common

  • prices (Prices) – instance of the class Prices

CPR.simulator.update_assets(hh, year, d_returns, common, prices)

Function that updates assets every year.

Parameters
  • hh (Hhold) – household

  • year (int) – year

  • d_returns (dict) – dictionary of returns

  • common (Common) – instance of the class Common

  • prices (Prices) – instance of the class Prices

CPR.simulator.manage_liquidations(hh, year, common, prices)

Function that manages the liquidation of assets upon retirement.

Parameters
  • hh (Hhold) – household

  • year (int) – year

  • common (Common) – instance of the class Common

  • prices (Prices) – instance of the class Prices

CPR.simulator.contribute_cpp(p, year, common)

Function that records CPP/QPP contributions.

Parameters
  • p (Person) – instance of the class Person

  • year (int) – year

  • common (Common) – instance of the class Common

CPR.simulator.claim_cpp(p)

Function to claim CPP/QPP benefits.

Parameters

p (Person) – instance of the class Person

CPR.simulator.check_tax_unreg(hh)

Function that checks whether there are taxable returns to assets.

Parameters

hh (Hhold) – household

Returns

True or False

Return type

bool

CPR.simulator.check_liquidation(hh)

Function to check whether there are liquidated assets to be taxed.

Parameters

hh (Hhold) – household

Returns

True or False

Return type

bool

CPR.simulator.prepare_taxes(hh, year, common, prices)

Function to prepare the variables used in the SRD (in nominal terms).

Parameters
  • hh (Hhold) – household

  • year (int) – year

  • common (Common) – instance of the class Common

  • prices (Prices) – instance of the class Prices

CPR.simulator.get_assets(p, common)

Function to retrieve assets for social assistance asset test.

Parameters
  • p (Person) – instance of the class Person

  • common (Common) – instance of class Common

CPR.simulator.compute_rpp(p, nom, common)

Compute rpp (DB and pension).

Parameters
  • p (Person) – instance of the class Person

  • nom (function) – function converting to nominal value

  • common (Common) – instance of the class Common

CPR.simulator.get_benefits_cpp(p, year, common)

Function that computes annual CPP/QPP retirement benefits.

s1 is the part of the supplementary benefit due to higher contribution rates in the 2019-2025 expansion; s2 is the part of the supplementary benefits attributable to changes in the YMPE; and PRB is for post-retirement benefits (for individuals who keep working after claiming – this feature is not used in the CPR, since individuals automatically claim in the year they retire).

Parameters
  • p (Person) – instance of the class Person

  • year (int) – year

  • common (Common) – instance of the class Common

CPR.simulator.get_inc_rrsp(p, nom)

Function that computes RRSP income from withdrawals.

Parameters
  • p (Person) – instance of the class Person

  • nom (function) – function converting to nominal value

CPR.simulator.get_other_taxable(p, nom, common)

Function that computes other taxable income.

Parameters
  • p (Person) – instance of the class Person

  • nom (function) – function converting to nominal value

  • common (Common) – instance of the class Common

CPR.simulator.get_other_non_taxable(p, nom)

Function that computes other non-taxable income.

Parameters
  • p (Person) – instance of the class Person

  • nom (function) – function converting to nominal value

CPR.simulator.get_contributions_assets(p, year, common)

Function that computes contributions to registered and unregistered accounts (including DC and DB RPP).

Parameters
  • p (Person) – instance of the class Person

  • year (int) – year

  • common (Common) – instance of the class Common

CPR.simulator.reset_accounts(hh)

Function that resets all variables to their initial values.

Parameters

hh (Hhold) – household