You can find the .ipynb for this video and some additional materials here: drive.google.com/drive/folders/1sP40IW0p0w5IETCgo464uhDFfdyR6rh7 Please consider supporting NEDL on Patreon: www.patreon.com/NEDLeducation
HI Nedl, I was wondering why you included mu in the parameter optimalisation algorithm. Is it not more efficient to use the data observed till time point t instead of the residuals? Thanks in advance.
Hi, and thanks for the great question! In most applications of GARCH I have encountered, it is quite standard to allow the mu parameter to vary in the optimisation process. I acknowledge that this leads to biased (although more efficient) estimates, so if you would like to keep your estimation unbiased, leave the mu constant to be equal to the sample mean.
@@NEDLeducation Hi Nedl, Thanks for the quick reply and clarification. The video really helped me memorising how to code EGARCH with different distributions. Keep up the work with these great videos!
Thank you so much NEDL, i have seen your videos of GARCH, ARCH, TGARCH and DCC about *100 of times they help me a lot in my bachelor dissertation, Can you please if it's possible make a tutoriel of those model in python or R, your explanation is the best. And also the copulas for defining the dependance structure of a portfolio, if it's possible. Best regards.
Hi, your videos are the best in the web to learning finance and econometrics. I was wondering if you could make an Arima midel example in excel due to this kind of models are very useful in the real life, overall if we work at Financial sector. Best regards from Mexico!
Hi, and thanks for the question! Yes, this is GARCH(1,1). The code in .ipynb format is available from the Google Drive - please check link in the pinned comment!
Hi, i replicated the code for my own stocks. However i cant get the graph to work at the end? Thanks! Edit: Just tried your code as well from google drive, same issue.
@@NEDLeducation hi, no worries managed to solve it. Turns out my instillation of anaconda broke when I forced update through the cmd. Just needed to reinstall!
Hello, one of the best video ever!!! but i have a challenge for you! Could you develop the code on python for a DCC-GARCH MODEL. Working with list of matrix could become a little bit complicated!
Hey, I found your channel recently and your contents are amazing. It really helps me to understand what is going on with all of those algorithms. I also would like to ask that can you implement GAS model. It is included in pyflux package but that is not supported anymore. So if you can do that, also we can learn details of the algorithm better as well. Thanks a lot again for great contents. You are inspiring ^-^
Hi Halil, and thanks so much for such kind words! Glad the videos helped. As for the GAS (generalised autoregressive score) models, this is just an umbrella term that includes all kinds of autoregressive volatility models, including ARCH, GARCH, EGARCH, TGARCH, GARCH-M, etc. I have got a full playlist dealing with each and every of these specifications. Please check out the Econometrics playlist here: th-cam.com/video/9C6oz_mADSE/w-d-xo.html
Hi Priyansh, and glad you liked the video! As for your question, one of the approaches would be to calculate long-run volatilities of your individual stocks, using (omega/(1 - alpha - beta))**(1/2).
I'm actually got an error: TypeError: float() argument must be a string or a number, not 'function' regarding the "res = spop.minimize(garch_mle...etc). I'm not using Jupyter by the way but VSCode
Hi Shenghuan, and glad you are enjoying the channel! A more natural and straightforward way of testing significance of GARCH parameters would be the likelihood ratio test: th-cam.com/video/BDAHUdNR7BI/w-d-xo.html. You can calculate standard errors for regular coefficient t-tests, but you need to compute the Hessian matrix for that (I might investigate this concept at some point in the future). Hope this helps!
@@NEDLeducation Thx!! I investigated Hessian matrix for 2 days, and found it would be quite difficult for me to calculate the second derivatives of the GARCH likelihood function.
Try the following command: $ python -m pip install yfinance It seems yfinance is not installed in your environment yet so it cannot be imported. Let me know if it works!
Hey NEDL, What if I wanted to build this code based on forex markets? How'd I modify this code? Only by modifying the ticker? Nice video btw, Regards from Brazil
Thank you for the great content. I learnt a lot. I was trying few things after watching the videos and got stuck. Q1. I have a AR(3)-GJR-GARCH(2,2,2) model like below. How can I test if the model has any leverage effect with 5% significance level? Which test do I run? best_gjr_garch = arch_model(in_sample_return[ticker],mean='AR',lags =3 ,vol='GARCH',p=2,o=2,q=2,dist='t').fit(update_freq=5) Q2. I also have a AR(3)-GJR-GARCH-M(2, 2, 2) model, how can In test the impact of risk on expected return at 5% significance level? Please help me with the method\, I am really stuck.
Hi, could u plz tell me what if we have 2 stocks? should we calculate every parameter separately like the codes below? BarrickGold ='^GOLD' APPLE = '^AAPL' start = '1995-12-01' end = '2021-12-01' #Downloading data prices1 = yf.download(BarrickGold, start, end)['Adj Close'] prices2 = yf.download(APPLE, start, end)['Adj Close'] #calulating returns returns1 = np.array(prices1)[1:]/np.array(prices1)[:-1] -1 returns2 = np.array(prices2)[1:]/np.array(prices1)[:-1] -1 thanks in advance
Thank you for ur great explanation, happy to find your channel :) I was wondering if u could guide me through an assignment? to start I should build a portfolio with 2 assets with weights of 20 and 80 %, using a univariate Garch model to find value at risk. The basic idea of the "dynamic" risk-based portfolio optimization is to reestimate the conditional volatility of the stock market on a weekly basis so that I can rebalance my portfolio such that it has the maximum expected return subject to a Value-at-Risk constraint. I have my data and I don't know where to start. thank you in advance .
You can find the .ipynb for this video and some additional materials here: drive.google.com/drive/folders/1sP40IW0p0w5IETCgo464uhDFfdyR6rh7
Please consider supporting NEDL on Patreon: www.patreon.com/NEDLeducation
Thank you! You is fantastic! From Brazil!
Thank you so much for this video!! I am close to finishing my thesis and this is was just what I needed!
Excelent explanation!!
Concise and well-explained. Thanks!
great work.
Fantastic work, thank you very much!
Hi, thanks for your introduction and I have a question. How could I modify the code from GARCH to t-GARCH?
HI Nedl, I was wondering why you included mu in the parameter optimalisation algorithm. Is it not more efficient to use the data observed till time point t instead of the residuals? Thanks in advance.
Hi, and thanks for the great question! In most applications of GARCH I have encountered, it is quite standard to allow the mu parameter to vary in the optimisation process. I acknowledge that this leads to biased (although more efficient) estimates, so if you would like to keep your estimation unbiased, leave the mu constant to be equal to the sample mean.
@@NEDLeducation Hi Nedl, Thanks for the quick reply and clarification. The video really helped me memorising how to code EGARCH with different distributions. Keep up the work with these great videos!
Thank you so much NEDL, i have seen your videos of GARCH, ARCH, TGARCH and DCC about *100 of times they help me a lot in my bachelor dissertation,
Can you please if it's possible make a tutoriel of those model in python or R, your explanation is the best.
And also the copulas for defining the dependance structure of a portfolio, if it's possible.
Best regards.
Hi Salah, and thanks so much for such kind words. I do intend making a follow-up video on advanced GARCH models in Python so stay tuned :)
thank you !!
Hi, your videos are the best in the web to learning finance and econometrics. I was wondering if you could make an Arima midel example in excel due to this kind of models are very useful in the real life, overall if we work at Financial sector.
Best regards from Mexico!
best Teacher …please make video on GARCH-MIDAS model Application
Hi Maria, and glad you liked the video. GARCH-MIDAS is definitely more tricky to implement, and I will see what I can do with it in the near future :)
hey NEDL is this the Garch 1,1 model? where can i get the code for it
Hi, and thanks for the question! Yes, this is GARCH(1,1). The code in .ipynb format is available from the Google Drive - please check link in the pinned comment!
@@NEDLeducation Hi, hope you are well. Awesome video btw but curious how can we tell in the code that it’s a GARCH(1,1) model.
Hi, i replicated the code for my own stocks. However i cant get the graph to work at the end? Thanks!
Edit: Just tried your code as well from google drive, same issue.
Hi, and thanks for the question! Could you specify what error message, if any, you are getting?
@@NEDLeducation hi, no worries managed to solve it. Turns out my instillation of anaconda broke when I forced update through the cmd. Just needed to reinstall!
Hello, one of the best video ever!!! but i have a challenge for you! Could you develop the code on python for a DCC-GARCH MODEL. Working with list of matrix could become a little bit complicated!
Hey, I found your channel recently and your contents are amazing. It really helps me to understand what is going on with all of those algorithms. I also would like to ask that can you implement GAS model. It is included in pyflux package but that is not supported anymore. So if you can do that, also we can learn details of the algorithm better as well.
Thanks a lot again for great contents. You are inspiring ^-^
Hi Halil, and thanks so much for such kind words! Glad the videos helped. As for the GAS (generalised autoregressive score) models, this is just an umbrella term that includes all kinds of autoregressive volatility models, including ARCH, GARCH, EGARCH, TGARCH, GARCH-M, etc. I have got a full playlist dealing with each and every of these specifications. Please check out the Econometrics playlist here: th-cam.com/video/9C6oz_mADSE/w-d-xo.html
@@NEDLeducation Thanks a lot. I will start to watch that. Appreciated that you put all of those great contents. 💯
Great video! How can I obtain the RMSE value if I am running this code on 30 different stocks?
Hi Priyansh, and glad you liked the video! As for your question, one of the approaches would be to calculate long-run volatilities of your individual stocks, using (omega/(1 - alpha - beta))**(1/2).
@@NEDLeducation heyy how do we calculate MAE and mdape please??
I'm actually got an error: TypeError: float() argument must be a string or a number, not 'function' regarding the "res = spop.minimize(garch_mle...etc). I'm not using Jupyter by the way but VSCode
I love you!
You are awesome!!! I am very eager to know how to estimate the standard error of the normal garch models, is that possible to be implemented in excel?
Hi Shenghuan, and glad you are enjoying the channel! A more natural and straightforward way of testing significance of GARCH parameters would be the likelihood ratio test: th-cam.com/video/BDAHUdNR7BI/w-d-xo.html. You can calculate standard errors for regular coefficient t-tests, but you need to compute the Hessian matrix for that (I might investigate this concept at some point in the future). Hope this helps!
@@NEDLeducation Thx!! I investigated Hessian matrix for 2 days, and found it would be quite difficult for me to calculate the second derivatives of the GARCH likelihood function.
A biblioteca Yahoo finance não esta funcionando. dá erro
Try the following command:
$ python -m pip install yfinance
It seems yfinance is not installed in your environment yet so it cannot be imported. Let me know if it works!
Hey NEDL,
What if I wanted to build this code based on forex markets? How'd I modify this code?
Only by modifying the ticker?
Nice video btw,
Regards from Brazil
Hi Bruno, and thanks for the question! Yes, it would be as easy as that. For example, for EUR/USD you would change the ticker to "EURUSD=X".
Thank you for the great content. I learnt a lot. I was trying few things after watching the videos and got stuck.
Q1. I have a AR(3)-GJR-GARCH(2,2,2) model like below. How can I test if the model has any leverage effect with 5% significance level? Which test do I run?
best_gjr_garch = arch_model(in_sample_return[ticker],mean='AR',lags =3 ,vol='GARCH',p=2,o=2,q=2,dist='t').fit(update_freq=5)
Q2. I also have a AR(3)-GJR-GARCH-M(2, 2, 2) model, how can In test the impact of risk on expected return at 5% significance level?
Please help me with the method\, I am really stuck.
Hi, could u plz tell me what if we have 2 stocks? should we calculate every parameter separately like the codes below?
BarrickGold ='^GOLD'
APPLE = '^AAPL'
start = '1995-12-01'
end = '2021-12-01'
#Downloading data
prices1 = yf.download(BarrickGold, start, end)['Adj Close']
prices2 = yf.download(APPLE, start, end)['Adj Close']
#calulating returns
returns1 = np.array(prices1)[1:]/np.array(prices1)[:-1] -1
returns2 = np.array(prices2)[1:]/np.array(prices1)[:-1] -1
thanks in advance
Hi Mina, and thanks for the question! Yes, if you have more than one time series, it is advised to calculate model parameters for them separately.
I'm so stealing this
Be my guest, glad the tutorial helped! :)
Thank you for ur great explanation, happy to find your channel :)
I was wondering if u could guide me through an assignment?
to start I should build a portfolio with 2 assets with weights of 20 and 80 %, using a univariate Garch model to find value at risk.
The basic idea of the "dynamic" risk-based portfolio optimization is to reestimate the conditional volatility of the stock market on a weekly basis so that I can rebalance my portfolio such that it has the maximum expected return subject to a Value-at-Risk constraint.
I have my data and I don't know where to start. thank you in advance .
Plz sir perform this garch model with different distribution in matlab as well