Skip to content

Commit

Permalink
Add description
Browse files Browse the repository at this point in the history
  • Loading branch information
tuduun committed Mar 28, 2024
1 parent 4d3bc5e commit 88f2fa9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/app/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@



def plot_irfs(irf, independent_var: str) -> None:
def plot_irfs(irf, independent_var: str, description: str) -> None:
"""
Plots impulse response functions (IRFs) showing the response of LAYOFFS to a shock in the specified independent variable.
Expand All @@ -17,6 +17,9 @@ def plot_irfs(irf, independent_var: str) -> None:
Returns:
None. The function directly renders the plot in a Streamlit application.
"""
st.write(" ")
st.write(f"**Graph for {independent_var}**")
st.write(description)
fig = irf.plot(impulse=independent_var, response='LAYOFFS', orth=True, subplot_params={'title': f'Response of LAYOFFS to a shock in {independent_var}'})
st.pyplot(fig)

Expand Down
11 changes: 9 additions & 2 deletions src/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ def main():
data = load_data('src/data/filtered_US_data.csv')
data['$ Raised (mm)^2'] = data['$ Raised (mm)']**2


description = ["Inflation on Layoffs graph illustrates how a positive shock in inflation affects the number of layoffs. We can see that a positive shock in inflation decreases the number of layoffs until it hits 0 in the 6th month. This does not seem to match the hypothesis that I initially came up with.",
"Industrial production on Layoffs graph shows a positive shock in the industrial production decreases layoffs until it reached 0 in the 8th month. This result lines up with Hypothesis 2: An increase in Industrial Production decreases Layoffs. This makes economic sense because if there is more production, there is more workforce behind the produced goods.",
"Federal Funds Rate (aka Interest Rates) on Layoffs graph tells how the federal funds rate affects the number of layoffs. According to the graph, we can see a positive shock in federal funds, layoffs decrease until the 3rd month. My hypothesis disagrees with this result because in economic theory, at times when interest rates are high, people save more and consume as little as possible. Moreover, jobs will not be created due to the businesses not borrowing any money with high-interest rates to do more projects. Thus, it is intuitive to think that higher interest rates will lead to more layoffs due to the slowing down of the economy and the increase in borrowing of money for businesses makes it expensive to hire employees. Thus, the VAR IRF does not support the economic theory.",
"Economic Uncertainty Index on Layoffs graph illustrates how the U.S economic uncertainty index affects layoffs. The graph starts with a positive spike and is on the positive side until it hits 0 at around the 2nd period. This is in line with the economic theory that supports that businesses are cutting back on the workforce during economic challenging times. Moreover, after the 2nd period in the IRF graph, the response(layoffs) fluctuates above and below the zero line, which suggests the impact of layoffs changes over time. Thus, the VAR IRF result was consistent with the H4: Increase in Economic Uncertainty index increases Layoffs."
"Layoffs on Layoffs does not mean that much."
]
# Load the dataset for VAR

var_data = prepare_raw_data(load_data('src/data/macro_seasonal_variables_data.csv'))
Expand Down Expand Up @@ -56,8 +63,8 @@ def main():
st.title('Impulse response functions')
st.write('This section shows the response of layoffs to shocks in various economic indicators.')
independent_variables = ['INFLATION', 'D_INDPRO', 'FEDFUNDS', 'UNCERTAINTY', 'LAYOFFS']
for independent_vars in independent_variables:
plot_irfs(irf, independent_vars)
for i in range(len(independent_variables)-1):
plot_irfs(irf, independent_variables[i], description[i])

if __name__ == "__main__":
main()

0 comments on commit 88f2fa9

Please sign in to comment.