To my knowledge, I was not able to find a python package that is able to do this kind of restriction. However, there is a package in R which is known as vars. Therefore, I had to augment the R package in python using the rpy2 interface.
This may be done easily but there is a list of events that should take place that allows you from python to call R functions (even packages) as vars package.
A summary using different package may be found in this link
However, for the sake of illustration here is my code
First you have to import vars to python as
# Import vars
Rvars = importr("vars", lib_loc = "C:/Users/Rami Chehab/Documents/R/win-library/3.3")
Then one need to fit a VAR model to your data (or Dataframe) say data
as
t=Rvars.VAR(data,p=2, type='const')
then afterwards one needs to apply a different function in the vars packages known by restrict which removes nonsignificant parameters
# Let us try restricting it
t1=Rvars.restrict(t,method = "ser")
The final steps that will allow you to observe the data is to call a built-in function in R known as summary as
# Calling built-in functions from R
Rsummary = robjects.r['summary']
now print the outcome as
print(Rsummary(t1))
This will give
Estimation results for equation Ireland.Real.Bond:
==================================================
Ireland.Real.Bond = Ireland.Real.Bond.l1 + Ireland.Real.Equity.l1 + Ireland.Real.Bond.l2
Estimate Std. Error t value Pr(>|t|)
Ireland.Real.Bond.l1 0.26926 0.11139 2.417 0.01739 *
Ireland.Real.Equity.l1 -0.21706 0.07618 -2.849 0.00529 **
Ireland.Real.Bond.l2 0.23929 0.09979 2.398 0.01829 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 14.41 on 103 degrees of freedom
Multiple R-Squared: 0.1041, Adjusted R-squared: 0.07799
F-statistic: 3.989 on 3 and 103 DF, p-value: 0.009862
Estimation results for equation Ireland.Real.Equity:
====================================================
Ireland.Real.Equity = Ireland.Real.Bond.l1 + Ireland.Real.Equity.l1 + const
Estimate Std. Error t value Pr(>|t|)
Ireland.Real.Bond.l1 0.7253 0.1585 4.575 1.33e-05 ***
Ireland.Real.Equity.l1 -0.3112 0.1068 -2.914 0.004380 **
const 7.7494 2.1057 3.680 0.000373 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 20.58 on 103 degrees of freedom
Multiple R-Squared: 0.2462, Adjusted R-squared: 0.2243
F-statistic: 11.21 on 3 and 103 DF, p-value: 1.984e-06