cointigration Flashcards
What is a hedge ratio ?
The independent variable Uses X times by the dependent variable
Which library has hedge ratio function in?
From statsmodels.api import OLS
Parameters independent dependent
output modelled.params for the hedge ratio
OLS stands
Ordinary least squares regression
How to set model
model=sm.OLS(y.iloc[:90],x.iloc[:90])
how to find the hedge fund ratio
model = model.fit()
print(model.params[0])
ADF
augmented Dickey–Fuller test (ADF) tests the null hypothesis that a stationarity unit root is present in a time series sample.
If ADF is lower that crital leve
We can reject the null hypothesis that the test data is not stationary, and say it has stationarity
CADF test results are lower than the 99% SDT statistically.
We reject the null hypothesis,
Therefore the data has stationarity, cointegrated augmented Dickey Fuller,
buy hedge ratio and then work out CADF
portfolio = y - model.params[0] * x cadf = ts.adfuller (portfolio.Close)
What are the shortcomings of the ADF test, how are they solved by using the Johansen test?
The Johansen test is not order related when considering cointegration, it is able to take more time series.
What indicates stationarity using the Johansen Test
If some eigenvalues are negative, then it is possible to create a linear stationarity
Makeup df with columns x y
df = pd.DataFrame( {‘x’: df_x[“Adj Close”] , ‘y’: df_y[‘Adj CLose’] } )
Johanson test and null hypothesis
Reject the null hypothesis if the probability value is less than or equal to 0.05. thus stationarity is found
test statistic = -1.480
critical value = {‘1%’: -3.434, ‘5%’ : -2.86, ‘10%’ : -2.56}
The test statistics is greater than critical values at 99%, 95%, and 90% confidence levels. So, we cannot reject the null hypothesis that the CL and BZ are not cointegrated from Oct 10, 2011 to Set 06, 2017.
Why is it an issue to have a negative regression coefficient for a stock, while building a custom basket for an Index Arbitrage Strategy?
We will be long a stock in both the index and the basket.