Hi, thanks for the video! I just want to add that when you using stats.kstest, by default it compares with standard normal distribution (std=1 and mean =0), however your stock returns has different std & mean, so you might want to add args in your function, then the stock return might fit normal distribution better for example: ks_stat, p_value = kstest(log_returns, 'norm', args = (mean, std))
@vladislavpyatnitskiy2 жыл бұрын
Thank you for a great content! I would like to add that there is one more test for normality which is Jarque-Bera test that should be familiar to students who have done econometrics. Therefore, I might suppose that you have completed non-economic major. However, I think it is nice to know other normality tests as well!
@sahilharidas47472 жыл бұрын
Great video! Just a bit of nit-picking though: at 13:00 when you subtract the mean and divide by standard deviation, you say that will 'normalise' the best and worst case scenarios when they are instead being 'standardised'
@retronexusnet3 жыл бұрын
excellent as always!
@yeuyang55519 ай бұрын
Before doing ks /sw test, did I need to standardize the log return?
@AkashChauhan-rw1qh3 жыл бұрын
Thanks for sharing with us........
@joaopedrorocha5693 Жыл бұрын
Wow, great class! Thanks! Was thinking that the mean of the simple return was a good to have a first idea of returns over time but it can overshoot a lot! Will be able to estimate better now! And learned what the heck a ks test is about hehe Thanks a lot! Just a tip ... I think that you could have just sum 1 to simple_returns instead of doing a list comprehension, it's cleaner and more efficient (on cell 57 of the notebook)
@kaiwang2924 Жыл бұрын
Simple and beautiful.
@sdsagdfd1173 жыл бұрын
Perfect
@DimitarDobrinov Жыл бұрын
Great explanation! I have a question. If arithmetic average of simple returns does not yield a correct measure of mean and we need to use geometric mean instead, what do we do with standard deviation? How will we compute standard deviation in a manner that deals with the fact that simple returns are not additive?
@MA-oj8zk Жыл бұрын
For those running into issues plotting the diagrams, replace df.Close.plot().update_layout(autosize=False,width=500,height=300).show(renderer="colab") with df.Close.plot().update_layout(autosize=False,width=500,height=300).show() Same for log_returns.plot(kind='hist').update_layout(autosize=False,width=500,height=300).show(renderer="colab") and log_returns.plot(kind = 'box').update_layout(autosize=False,width=350,height=500).show(renderer="colab")
@FRANKWHITE19963 жыл бұрын
Thanks 🙌
@joshuaGmartin202311 ай бұрын
Great stuff
@gian_piano2 жыл бұрын
awesome content thank you so much!
@modeocheng2190 Жыл бұрын
fantastic!
@carlosarrieta11453 жыл бұрын
in which IDLE are you runing your code?
@QuantPy3 жыл бұрын
This is Jupyter Lab (notebooks) for python. If you’re using straight IDE, I like to use Visual Studio Code 👍
@ncheymbamalu40133 жыл бұрын
Stock returns and log returns can be modeled more accurately with the t-distribution.
@sahilharidas47472 жыл бұрын
More generally, the t-distribution is better suited when the underlying population variance is unknown, as is usually the case in practice. However, the t-distribution becomes the standard normal distribution as the number of degrees of freedom approaches infinity.
@wilsongomes33602 жыл бұрын
good job. tks
@vladk91523 жыл бұрын
In a lot of engineering projects we ignore >3sigma events. Is it the same for finance projections? Let's say i want to make an ARIMA projection, or a monte carlo simulation. Should i keep these rare events as useful data?
@TheMLPRyan3 жыл бұрын
Yes keep the rare events, have a look at what happened to LTCM when they didn’t include large deviations from their models.
@steez543212 жыл бұрын
So what's the solution to this? Most all of theoretical finance assumes a normal distribution (Markowitz theory, CAPM, Black-Scholes). What do quants do in the real world when returns are not normally distributed?
@QuantPy2 жыл бұрын
Excellent question, obviously there is no one answer that solves all problems. However things for you to research, a way to model different distributions for various assets is through copulas. This could be incorporated through Monte Carlo simulations for either “real” world risk or portfolio optimisation or “risk-neutral” world derivative valuation
@steez543212 жыл бұрын
@@QuantPy do you have any materials or information you could point me to that talk about how to deal with non normal data in finance? I'm aware of copulas but am definitely not an expert and haven't see how they can help with non normal data. My understanding was that copulas are used for risk management. When you say use monte carlo is it just a matter of making random draws from an empirical distribution rather than the normal distribution and seeing how that affects an option price for example?
@omololaomotalade81052 жыл бұрын
Hello, I got the same figure when adding log or simple return to the beginning price to get the ending price. My code: For log_return: data.Price[0] * np.exp(data['log_return'].mean() * len('log_return')) This code did not give me the price at the end of the timeseries For simple_return : data.Price[0] * (1 + data['simple_return'].mean()) ** len('simple_return') . Is there something I am doing wrong? Kindly respond.
@jure48353 жыл бұрын
Doesn't this basically show that log returns are normally distributed and therefore the stock returns have a lognormal distribution?
@QuantPy3 жыл бұрын
Log returns could be normally distributed, depends on your data. Yes modelling stock returns with a lognormal distribution is a strong assumption, but one that is made often
@shaaf98173 жыл бұрын
Do some videos on crypto
@ooddy243 жыл бұрын
I would appreciate if you would move your picture outside of the script...it is hard enough to see the blurred script because its small scale. And your photo makes it worst...
@QuantPy3 жыл бұрын
Thanks Manit, all code on my website in the link in the description if you’ve missed anything 👍
@MA-oj8zk Жыл бұрын
For those running into issues with the yahoofinance pandareader, here's the fix: import yfinance as yf yf.pdr_override()