In [11]:
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline  

N = 100

G     = 20
theta = 0.2
alpha = 0.95

C   = np.zeros(N) # consumption
Y   = np.zeros(N) # income
Y_d = np.zeros(N) # disposable income
T   = np.zeros(N) # tax revenue
H_h = np.zeros(N) # private savings
H_g = np.zeros(N) # government debt

for t in range(0, N):
    
    # calculate consumer spending
    C[t]   = alpha*Y_d[t-1] 
    
    # calculate total income (consumer spending plus constant government spending)
    Y[t]   = G + C[t] 
    
    # calculate the tax take
    T[t] = theta * Y[t]
    
    # calculate disposable income
    Y_d[t] = Y[t] - T[t]
    
    # calculate the change in private savings
    H_h[t] = H_h[t-1] + (1-alpha)*Y_d[t-1] 
    
    # calculate the change in government debt
    H_g[t] = H_g[t-1] + T[t]- G

In [13]:
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline  

N = 200

alpha = 0.95

C   = np.zeros(N) # consumption
Y   = np.zeros(N) # income
Y_d = np.zeros(N) # disposable income
T   = np.zeros(N) # tax revenue
H_h = np.zeros(N) # private savings
H_g = np.zeros(N) # government debt

G   = np.zeros(N)
theta   = np.zeros(N)

G[0:75] = 20
G[75:]  = 20

theta[0:75] = 0.2
theta[75:]  = 0.2

for t in range(0, N):
    
    # calculate consumer spending
    C[t]   = alpha*Y_d[t-1] 
    
    # calculate total income (consumer spending plus constant government spending)
    Y[t]   = G[t] + C[t] 
    
    # calculate the tax take
    T[t] = theta[t] * Y[t]
    
    # calculate disposable income
    Y_d[t] = Y[t] - T[t]
    
    # calculate the change in private savings
    H_h[t] = H_h[t-1] + (1-alpha)*Y_d[t-1] 
    
    # calculate the change in government debt
    H_g[t] = H_g[t-1] + T[t]- G[t]

In [14]:
fig = plt.figure(figsize=(12, 8))

consumption_plot = fig.add_subplot(241, xlim=(0, N), ylim=(0, np.max(Y)))
consumption_plot.plot(range(N), C, lw=3)
consumption_plot.grid()
# label axes
plt.xlabel('time')
plt.ylabel('consumption')

gov_plot = fig.add_subplot(242, xlim=(0, N), ylim=(0, np.max(Y)))
gov_plot.plot(range(N), G, lw=3)
gov_plot.grid()
# label axes
plt.xlabel('time')
plt.ylabel('government spending')

income_plot = fig.add_subplot(243, xlim=(0, N), ylim=(0, np.max(Y)))
income_plot.plot(range(N), Y, lw=3)
income_plot.grid()
# label axes
plt.xlabel('time')
plt.ylabel('income')

savings_plot = fig.add_subplot(244, xlim=(0, N), ylim=(0, np.max(H_h)))
savings_plot.plot(range(N), H_h, lw=3)
savings_plot.grid()
# label axes
plt.xlabel('time')
plt.ylabel('private savings')

gov_plot = fig.add_subplot(245, xlim=(0, N), ylim=(0, np.max(G)*1.5))
gov_plot.plot(range(N), G, lw=3)
gov_plot.grid()
# label axes
plt.xlabel('time')
plt.ylabel('government spending')

tax_plot = fig.add_subplot(246, xlim=(0, N), ylim=(0, np.max(G)*1.5))
tax_plot.plot(range(N), T, lw=3)
tax_plot.grid()
# label axes
plt.xlabel('time')
plt.ylabel('tax revenue')

deficit_plot = fig.add_subplot(247, xlim=(0, N), ylim=(np.min(T-G)*1.5,0))
deficit_plot.plot(range(N), T-G, lw=3)
deficit_plot.grid()
# label axes
plt.xlabel('time')
plt.ylabel('government budget')

debt_plot = fig.add_subplot(248, xlim=(0, N), ylim=(np.min(H_g)*1.5,0))
debt_plot.plot(range(N), H_g, lw=3)
debt_plot.grid()
# label axes
plt.xlabel('time')
plt.ylabel('government debt')

# space subplots neatly
plt.tight_layout()



In [17]:
H_g[-1]+H_h[-1]


Out[17]:
-66.666666666668334

In [5]:
G-T[-1]


Out[5]:
3.333333333353437

In [18]:
C[-1]


Out[18]:
63.333333333333265
$$ \begin{array}{lcl} Y^* = C^* + G \hspace{1cm} & (6) \\ T^* = \theta Y^* \hspace{1cm} & (7) \\ Y_{d}^* = Y^* - T^* \hspace{1cm} & (8) \\ C^* = \alpha Y_{d}^* \hspace{1cm} & (9) \\ \end{array} $$

By substituting equation 7 into equation 8 we get:

$$Y_{d}^* = Y^* - \theta Y^*$$

which we can then substitue into equation 9:

$$C^* = \alpha (Y^* - \theta Y^*)$$

and then back into equation 6:

$$Y^* = \alpha Y^* (1 - \theta) + G$$

Rearranging this gives:

$$Y^* - \alpha Y^* (1 - \theta) = G$$$$Y^* - \alpha Y^* + \alpha Y^* \theta = G$$$$Y^* (1 - \alpha + \alpha \theta) = G$$

Rearranging this gives: $$1 = \alpha (1 - \theta) + G/Y^*$$ $$1 - \alpha (1 - \theta) = G/Y^*$$

$$Y^* (1 - \alpha (1 - \theta)) = G$$$$ Y^* = \frac {G}{(1 - \alpha + \alpha \theta)} \hspace{1cm} (10)$$$$ \frac {Y^*}{G} = \frac {1}{(1 - \alpha + \alpha \theta)} \hspace{1cm} (11)$$

In [7]:
1/(1- alpha*(1 - theta))


Out[7]:
4.166666666666667

In [8]:
Y[-1]/G


Out[8]:
4.1666666666616408

In [9]:
alpha


Out[9]:
0.95

In [10]:
G*(alpha*(1-theta)-1)


Out[10]:
-4.8

We can solve this for either G or $\theta$

G in terms of nominal GDP and savings and taxation $$ G = Y^* (1 - \alpha + \alpha \theta) \hspace 1 cm (12)$$

G relative to Y $$ \frac {G}{Y^*} = 1 - \alpha + \alpha \theta \hspace 1 cm (13)$$

Tax rate in terms of nominal GDP $$ \theta = \frac {G}{\alpha Y^*} - \Big (\frac {1}{\alpha} - 1 \Big ) \hspace 1 cm (14)$$

so ratio of government spend to consumption minus an adjustment factor related to savings


In [12]:
G/(alpha*Y[-1]) - (1/alpha - 1)


Out[12]:
0.20000000000030477

In [114]:
-1/alpha + 1


Out[114]:
-0.05263157894736836
$$ \begin{array}{lcl} Y^* = C^* + G \hspace{1cm} & (6) \\ T^* = \theta Y^* \hspace{1cm} & (7) \\ Y_{d}^* = Y^* - T^* \hspace{1cm} & (8) \\ C^* = \alpha Y_{d}^* \hspace{1cm} & (9) \\ \end{array} $$$$\frac {T^* - G}{Y^*} = \theta - \frac {G}{Y^*}$$$$\frac {T^* - G}{Y^*} = \alpha + \theta - \alpha \theta - 1$$$$T^* - G = \Big (\frac {\alpha + \theta - \alpha \theta - 1}{1 - \alpha + \alpha \theta} \Big ) G$$$$T^* - G = \Big (\frac {\alpha - \alpha \theta + \theta - 1}{- \alpha + \alpha \theta + 1} \Big ) G$$$$T^* - G = \Big ( \frac {\theta}{1 - \alpha + \alpha \theta} - 1 \Big ) G$$

In [121]:
alpha + theta - alpha*theta -1


Out[121]:
-0.040000000000000036

In [29]:
(T[-1] - 20)/Y[-]


Out[29]:
-0.040000000000289491

In [25]:
theta - G/Y[-1]


Out[25]:
-0.040000000000289471

In [ ]: