I am helping a friend with their thesis in statistics and we need to make a SVAR. I have the following output from VAR which I want to use as an input to SVAR (Not sure if that is the correct input) but any input of any dimension I send into SVAR executes but gives the following error when I try to run .fit() on it:
ValueError: shape mismatch: value array of shape (0,) could not be broadcast to indexing result of shape (0,6,6)
The code I have is displayed below, what is the issue and is there a better way to collect the data from SVAR to then visualize it? Should the input be different?
svarinput = [
[ 1.000000, -0.587525, -0.554453, 0.306329, 0.218910, 0.013468],
[-0.587525, 1.000000, 0.528954, -0.130117, -0.105632, -0.016493],
[-0.554453, 0.528954, 1.000000, 0.041466, -0.103796, 0.097468],
[ 0.306329, -0.130117, 0.041466, 1.000000, 0.265418, 0.068111],
[ 0.218910, -0.105632, -0.103796, 0.265418, 1.000000, 0.043339],
[ 0.013468, -0.016493, 0.097468, 0.068111, 0.043339, 1.000000]
]
# # Define your restriction matrix
A = np.array([
[1, 0, 0, 0, 0, 0], # Housing Index
[0, 1, 0, 0, 0, 0], # Policy Rate
[0, 1, 1, 0, 0, 0], # Mortgage Rates
[0, 0, 0, 1, 0, 0], # Inflation
[0, 0, 0, 0, 1, 0], # Household Debt
[0, 0, 0, 0, 0, 1] # Covered Bonds
])
# # # Create SVAR model with the VAR fit and your restriction matrix
# # svar_model = SVAR(var_fit, A=restriction_matrix, svar_type='A')
svar_model = SVAR(svarinput, svar_type='A',A=A)
svar_results = svar_model.fit()
I have a research question where the aim in to see how Housing Index is affected by a Central Banks purchases of covered bonds. My data consists of, Housing Index, Policy rate, Mortgage rates, Covered Bonds, Household Debt-to-GDP ratio and Inflation.
I planned to do the analysis in the following order and have finished only step 1-4.
- Akaike Information Criterion (selection lag - chose 1)
- Augmented Dickey Fuller test (test for stationary - did not have stationary in any variable except covered bonds)
- Johansen Cointegration test - Test for cointegration since the variables were not stationary
- Vector Error Correction Model - Since there was cointegration
- Structural Vector Autoregression Model
- Impulse Response Function - I understand this part but haven't come this far
- Forecast Error Variance Decomposition
-
Interesting question, but it's off topic here since it's conceptual in nature; try stats.stackexchange.com instead.Robert Dodier– Robert Dodier2024年05月24日 17:13:17 +00:00Commented May 24, 2024 at 17:13
-
If you found statistical evidencie that your system is cointegrated, a SVAR would be mispecified most likelyJorge Alonso– Jorge Alonso2024年09月19日 16:35:23 +00:00Commented Sep 19, 2024 at 16:35