Simulating economic models - is there a more pythonic way of doing this?

January 24, 2018, at 6:49 PM

I'm currently trying to simulate some basic economic models in Python. I'm new to programming and used to simulating in Excel using this kind of row by row method.

The model I'm working with has 7 equations, 6 predetermined parameters and 9 endogenous variables determined by the equations.

Basically what I want to do is:

  • set an initial level of capital at time 0
  • calculate values for the other variables for time 0 using the set of equations and parameters
  • use these calculated variables to compute a capital growth rate and use it to set a new level of capital in time 1
  • repeat up these steps up to t = 100
  • Save the variable values for each year in a pandas dataframe for analysis and plotting.

The code below shows a simplified version of what I'm currently doing. It gives me exactly what I want, but as I'm new to programming I suspect there is a much more intuitive way of doing this? Any input is appreciated.

#Create initial empty lists to be populated with time series of variables
list_employment = []
list_wage = []
#Set parameters
a = 0.33
b = 2.65
#Calculate endogenously determined variables
for year in range(T):
    employment = capital(a * b / c)
    wage = employment(x * y * z)
    change_in_capital = capital(a - employment * wage) - capital * z
    #Append these variables to previously created lists
    #Update capital variable
    capital = capital + change_in_capital
#Put lists into pandas dataframe
time_series_df = pd.DataFrame( {'Employment' : list_employment, 
                            'Wage' : list_wage, 
Rent Charter Buses Company
Name of Current Service in Google App Engine (Python)

Name of Current Service in Google App Engine (Python)

Using the Google App Engine Python API is there a way to access the name of the currently running service --ie

Keras LSTM model has very low accuracy

Keras LSTM model has very low accuracy

I am trying to build a model that takes a sentence as input, takes each word and tries to predict the next wordMy input and output both are a 3D matrix with (number of sentences, number of words per sentence, dimension of word embedding)

Creating a subclass without direct access to the parent class __init__() function

Creating a subclass without direct access to the parent class __init__() function

I'm using the DroneKit API in Python for controlling a drone using a companion computerI'm trying to create a class, Vehicle, which inherits from the Vehicle class in DroneKit