@@dirtyquant Hey you are even answering to comments, amazing! :D Quick question: The simulated price paths all have certain characteristics from the "real" returns in common, right? I am backtesting a strategy and would like to see how much those characteristics (I assume it's the mean and the standard deviation) can change until my strategy doesn't work anymore. Does this make sense to you? Where do I actually see what "characteristics" the GARCH simulator pulls from "returns"? How could I insert values here manually to see when my strategy doesn't work anymore? Thanks already!
@@juliangoogle6022 Hey, so you can play around with the Beta (the memory) and the alpha (the shock) which will define how much "Garchness" there is. At the same time, mu (the mean) nu (the degrees of freedom) and lambda (the skewness) will also define what the return series look like. I would start by fixing all the parameters except one, and changing it whilst feeding into your backtester and see when things start breaking down. most of these won't have massive realistic ranges (Beta is always around 0.9) so your search universe won't be huge. Hope that helped.
@@dirtyquant Okay got it, thank you! I think for the analysis, it would be more intuitive to a reader to see how much the volatility or the mean return can change until the strategy breaks instead of the greek parameters, is there a way to translate that in this case?
I also simulated price paths with the Geometric Brownian motion, here it is easy because the whole model consists of the mean and the volatility but I would love to do it with GARCH because this takes the volatiltiy clustering into account
Basically the same is happening in your example here. The returns you are pulling have a mean value of 0.0178. The model has a mu of 0.0669, and some random price paths I just generated were also far above the return of 0.01.. ?
Hey Julian, I am out travelling (at PyCon actually) so can’t look into this too much, but you could just re-mean it to whatever you like. You subtract the average mean, and punch in the value that you like. Easy dirty quant solution!
@@dirtyquant Appreciate the answer! I could do this, but I want to use the simulated price paths in an academic paper so I need to justify decisions like this.. you see what I mean? Enjoy PyCon!!!
@@juliangoogle6022 now you got me thinking. Let me try and run some stuff now and see what is up. When you get an ear worm like this you can’t let it slide. Will get back to you
Ok, so I ran the simulator and it actually looks fine. There is a distribution for the mean as well. Sometimes it will be more, sometimes it will be less. It won't be a constant for each of those runs. Run the notebook and then look at sim_df.mean(axis=0).mean() It gave me something that's within the confidence interval of the output of garch_output.summary at the beginning of the notebook It will hold for academic papers 🙂
@@dirtyquant Yes so the mean of the sim_df.mean is consistent with the mu value of the GARCH model, but I suspect the mu value (and with that also the confidence intervals in the garch_output.summary) to be too optimistic, no? If I take the mean of the returns you pull from yahoo I get 0.021428 (with the command returns.mean()). And the mu in the GARCH model is 0.0524 --> more than double? So as a result all the price paths simulated with the GARCH model will be much more bullish than the real data we pulled right? For me, this doesn't make sense logically: I throw data with mean 0.02 into a model and the model returns the mean 0.05. This also makes the forecasts unsuitable for backtesting because they are way too bullish
Hey your videos are informative and helpful and good at breaking things down to the basics and small chunks. I've been modelling GARCH volatility recently and am wondering how appropriate it is to simulate the volatility as you have done but instead of using the associated returns series extract the volatility and use it in my own stock price process definition? The process by which the returns series is generated is a bit of a black box (to me at least) and I'm modelling for geometric brownian motion with a default parameter. Thanks!
Hi Isaac, bit hard to make a comment based on what you have provided, but that's the beauty of this subject, there is no right or wrong answer, just whatever works in your situation. If the output data seems to look like real data, then happy days! All of these are just models, not fact, they just try an approximate real life in a way that is explainable and repeatable, but the real world doesn't care about out little formulas. Glad you enjoy the videos though 😃
there is also another technique for simulate returns called block boostrapping. Indeed the library arch that you are using in this video has functions for that. It would be interesting that you could do a video about it. As far as i have searched , in youtube there is no body yet that have talked about that.
Hey mate. Never heard of that. Where did you see it? There seem to be a million variations of GARCH out in the wild, as it’s up to you. I am sure there is a Banana-GARCH which has banana prices as an exogenous variable 🍌
Hey mate, one more question: How come that the sim returns all seem to take off pretty quickly after a certain number of days? Context: I use 36 years of Eurostoxx600 (index with 600 largest European companies) data to get the GARCH parameters. In real life, I obtain a CAGR of 4.35%, the mean CAGR of many many simulated returns based on these parameters is 8.3%. So it seems like the GARCH model is too bullish over a longer period of time...
If I compare it to the price paths I simulated with the Geometric Brownian motion, they pretty much stick to the drift and the random walk component, also in the long run ... How come the GARCH model loses its stated "constant mean" after a while?? And is there something I can do to avoid it? My idea is to use the log returns instead of the normal daily returns to "normalize" and hopefully stabilize the model a bit. EDIT: Using log returns didn't change a lot, I obtain very similiar results
Okay, but... If I can incorporate GARCH (or any other data generating precess) into backtesting procedure, I can incorporate it into my model. And if the process assumed by model and backtest is the same, I will get ridiculously good backtesting results. This makes backtesting meaningless. If can build GARCH into backtest, why not use it in the model?
Hi Oleksandr, great question. There will always be an element of uncertainly/randomness when you run each path, but the main characteristics of the data will be there. It does indeed depends if your model is GARCH based, or if you are looking at say, a momentum or long term reversion model etc, then the 2 won't be equal. But I do agree, if you make both your data generation process and your trading model GARCH based, it will be sub optimal. Either way, this is a way to generate data which has identical characteristics to real data, without fine tuning your trading model to perfectly fit the 1 data series you have. thanks for your contribution and for watching :-)
Great video :)
6:25: you should be able to select only one by double clicking on the legend
Thanks so much mate. Will try that out
You are a natural! You have a great character. I think I am learning. Subscribed and I look forward to the future videos :)
Thank you sir! Appreciate the sub and love. Hope you been well
Excellent content, You have gotten a new subscriber.
Thanks so much Kevin. Glad you are liking the content!
Great video!
Thanks!
@@dirtyquant Hey you are even answering to comments, amazing! :D
Quick question: The simulated price paths all have certain characteristics from the "real" returns in common, right? I am backtesting a strategy and would like to see how much those characteristics (I assume it's the mean and the standard deviation) can change until my strategy doesn't work anymore.
Does this make sense to you? Where do I actually see what "characteristics" the GARCH simulator pulls from "returns"? How could I insert values here manually to see when my strategy doesn't work anymore?
Thanks already!
@@juliangoogle6022 Hey, so you can play around with the Beta (the memory) and the alpha (the shock) which will define how much "Garchness" there is. At the same time, mu (the mean) nu (the degrees of freedom) and lambda (the skewness) will also define what the return series look like. I would start by fixing all the parameters except one, and changing it whilst feeding into your backtester and see when things start breaking down.
most of these won't have massive realistic ranges (Beta is always around 0.9) so your search universe won't be huge.
Hope that helped.
@@dirtyquant Okay got it, thank you! I think for the analysis, it would be more intuitive to a reader to see how much the volatility or the mean return can change until the strategy breaks instead of the greek parameters, is there a way to translate that in this case?
I also simulated price paths with the Geometric Brownian motion, here it is easy because the whole model consists of the mean and the volatility but I would love to do it with GARCH because this takes the volatiltiy clustering into account
Basically the same is happening in your example here. The returns you are pulling have a mean value of 0.0178. The model has a mu of 0.0669, and some random price paths I just generated were also far above the return of 0.01.. ?
Hey Julian, I am out travelling (at PyCon actually) so can’t look into this too much, but you could just re-mean it to whatever you like. You subtract the average mean, and punch in the value that you like.
Easy dirty quant solution!
@@dirtyquant Appreciate the answer! I could do this, but I want to use the simulated price paths in an academic paper so I need to justify decisions like this.. you see what I mean? Enjoy PyCon!!!
@@juliangoogle6022 now you got me thinking. Let me try and run some stuff now and see what is up. When you get an ear worm like this you can’t let it slide. Will get back to you
Ok, so I ran the simulator and it actually looks fine. There is a distribution for the mean as well. Sometimes it will be more, sometimes it will be less. It won't be a constant for each of those runs.
Run the notebook and then look at sim_df.mean(axis=0).mean()
It gave me something that's within the confidence interval of the output of garch_output.summary at the beginning of the notebook
It will hold for academic papers 🙂
@@dirtyquant Yes so the mean of the sim_df.mean is consistent with the mu value of the GARCH model, but I suspect the mu value (and with that also the confidence intervals in the garch_output.summary) to be too optimistic, no? If I take the mean of the returns you pull from yahoo I get 0.021428 (with the command returns.mean()). And the mu in the GARCH model is 0.0524 --> more than double?
So as a result all the price paths simulated with the GARCH model will be much more bullish than the real data we pulled right?
For me, this doesn't make sense logically: I throw data with mean 0.02 into a model and the model returns the mean 0.05. This also makes the forecasts unsuitable for backtesting because they are way too bullish
Hey your videos are informative and helpful and good at breaking things down to the basics and small chunks.
I've been modelling GARCH volatility recently and am wondering how appropriate it is to simulate the volatility as you have done but instead of using the associated returns series extract the volatility and use it in my own stock price process definition?
The process by which the returns series is generated is a bit of a black box (to me at least) and I'm modelling for geometric brownian motion with a default parameter.
Thanks!
Hi Isaac, bit hard to make a comment based on what you have provided, but that's the beauty of this subject, there is no right or wrong answer, just whatever works in your situation. If the output data seems to look like real data, then happy days! All of these are just models, not fact, they just try an approximate real life in a way that is explainable and repeatable, but the real world doesn't care about out little formulas.
Glad you enjoy the videos though 😃
You are great!!!
Thank you so much Shaza!
there is also another technique for simulate returns called block boostrapping. Indeed the library arch that you are using in this video has functions for that. It would be interesting that you could do a video about it. As far as i have searched , in youtube there is no body yet that have talked about that.
Sweet. Let me look into it
Can I get some information for generalized autoregressive score model?
I want to know the score driven garch model.
Hey mate. Never heard of that. Where did you see it?
There seem to be a million variations of GARCH out in the wild, as it’s up to you.
I am sure there is a Banana-GARCH which has banana prices as an exogenous variable 🍌
Hey mate, one more question: How come that the sim returns all seem to take off pretty quickly after a certain number of days?
Context: I use 36 years of Eurostoxx600 (index with 600 largest European companies) data to get the GARCH parameters. In real life, I obtain a CAGR of 4.35%, the mean CAGR of many many simulated returns based on these parameters is 8.3%.
So it seems like the GARCH model is too bullish over a longer period of time...
If I compare it to the price paths I simulated with the Geometric Brownian motion, they pretty much stick to the drift and the random walk component, also in the long run ... How come the GARCH model loses its stated "constant mean" after a while?? And is there something I can do to avoid it?
My idea is to use the log returns instead of the normal daily returns to "normalize" and hopefully stabilize the model a bit. EDIT: Using log returns didn't change a lot, I obtain very similiar results
Okay, but... If I can incorporate GARCH (or any other data generating precess) into backtesting procedure, I can incorporate it into my model. And if the process assumed by model and backtest is the same, I will get ridiculously good backtesting results. This makes backtesting meaningless. If can build GARCH into backtest, why not use it in the model?
Hi Oleksandr, great question. There will always be an element of uncertainly/randomness when you run each path, but the main characteristics of the data will be there.
It does indeed depends if your model is GARCH based, or if you are looking at say, a momentum or long term reversion model etc, then the 2 won't be equal.
But I do agree, if you make both your data generation process and your trading model GARCH based, it will be sub optimal.
Either way, this is a way to generate data which has identical characteristics to real data, without fine tuning your trading model to perfectly fit the 1 data series you have. thanks for your contribution and for watching :-)