示例#1
0
PrintAges = False #Prints the different key ages in the demographics
PrintSS = False #Prints the result of the Steady State functions
CalcTPI = False #Activates the calculation of Time Path Iteration
#NOTE: Graphing only works if CalcTPI is activated.
Graphs = True #Activates graphing the graphs.
CountryNamesON = False #Turns on labels for the graphs. Replaces "Country x" with proper names.
DiffDemog = True #Turns on different demographics over countries. 

#MAIN CODE

#Gets demographic data
demog_params = (I, S, T, T_1, StartFertilityAge, EndFertilityAge, StartDyingAge, MaxImmigrantAge, g_A)
FertilityRates, MortalityRates, Migrants, N_matrix, Nhat_matrix = Stepfuncs.getDemographics(demog_params, PrintAges, DiffDemog)

for i in range(I):
	Stepfuncs.plotDemographics((S,T),i,[0,24],str("Country "+str(i)), N_matrix)

#Initalizes initial guesses
assets_guess = np.ones((I, S-1))*.15
kf_guess = np.zeros((I))

#Gets the steady state variables
params_ss = (I, S, beta, sigma, delta, alpha, e, A)
assets_ss, kf_ss, kd_ss, n_ss, y_ss, r_ss, w_ss, c_vec_ss = Stepfuncs.getSteadyState(params_ss, assets_guess, kf_guess)

if PrintSS==True: #Prints the results of the steady state, line 23 activates this
	print "assets steady state", assets_ss
	print "kf steady state", kf_ss
	print "kd steady state", kd_ss
	print "n steady state",n_ss
	print "y steady state", y_ss