# ====== Make the list of consumer types for estimation =========== #================================================================== # Set target Lorenz points and K/Y ratio (MOVE THIS TO SetupParams) if Params.do_liquid: lorenz_target = np.array([0.0, 0.004, 0.025,0.117]) KY_target = 6.60 else: # This is hacky until I can find the liquid wealth data and import it lorenz_target = getLorenzPercentiles(Params.SCF_wealth,weights=Params.SCF_weights,percentiles=Params.percentiles_to_match) #lorenz_target = np.array([-0.002, 0.01, 0.053,0.171]) KY_target = 10.26 # Make a vector of initial wealth-to-permanent income ratios w0_vector = generateDiscreteDraws(P=Params.w0_probs, X=Params.w0_values, N=Params.sim_pop_size, seed=Params.w0_seed) # Make the list of types for this run, whether infinite or lifecycle if Params.do_lifecycle: # Make base consumer types for each education level DropoutType = cstwMPCagent(**Params.init_dropout) DropoutType.w0 = w0_vector HighschoolType = deepcopy(DropoutType) HighschoolType(**Params.adj_highschool) CollegeType = deepcopy(DropoutType) CollegeType(**Params.adj_college) DropoutType.update() HighschoolType.update() CollegeType.update()
# Set booleans to determine which tasks should be done estimate_model = True compute_standard_errors = False make_contour_plot = False #===================================================== # Define objects and functions used for the estimation #===================================================== # Make a lifecycle consumer to be used for estimation, including simulated shocks EstimationAgent = Model.ConsumerType(**Params.init_consumer_objects) # Make histories of permanent and transitory shocks, plus an initial distribution of wealth scriptR_shocks, xi_shocks = Model.generateIncomeShockHistoryLognormalUnemployment(EstimationAgent) w0_vector = generateDiscreteDraws(P=Params.initial_wealth_income_ratio_probs, X=Params.initial_wealth_income_ratio_vals, N=Params.num_agents, seed=Params.seed) EstimationAgent.addIncomeShockPaths(scriptR_shocks,xi_shocks) # Define the objective function for the estimation def smmObjectiveFxn(beth, rho, agent = EstimationAgent, beth_bound = Params.beth_bound, rho_bound = Params.rho_bound, empirical_data = Data.w_to_y_data, empirical_weights = Data.empirical_weights, empirical_groups = Data.empirical_groups, initial_wealth = w0_vector, map_simulated_to_empirical_cohorts = Data.simulation_map_cohorts_to_age_indices): ''' The objective function for the SMM estimation. Given values of discount-factor