Python for Finance: Are stock returns normally distributed?

  Рет қаралды 15,661

QuantPy

QuantPy

Күн бұрын

Пікірлер: 32
@weirdcuteai
@weirdcuteai 3 жыл бұрын
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))
@vladislavpyatnitskiy
@vladislavpyatnitskiy 2 жыл бұрын
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!
@sahilharidas4747
@sahilharidas4747 2 жыл бұрын
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'
@retronexusnet
@retronexusnet 3 жыл бұрын
excellent as always!
@yeuyang5551
@yeuyang5551 9 ай бұрын
Before doing ks /sw test, did I need to standardize the log return?
@AkashChauhan-rw1qh
@AkashChauhan-rw1qh 3 жыл бұрын
Thanks for sharing with us........
@joaopedrorocha5693
@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
@kaiwang2924 Жыл бұрын
Simple and beautiful.
@sdsagdfd117
@sdsagdfd117 3 жыл бұрын
Perfect
@DimitarDobrinov
@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
@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")
@FRANKWHITE1996
@FRANKWHITE1996 3 жыл бұрын
Thanks 🙌
@joshuaGmartin2023
@joshuaGmartin2023 11 ай бұрын
Great stuff
@gian_piano
@gian_piano 2 жыл бұрын
awesome content thank you so much!
@modeocheng2190
@modeocheng2190 Жыл бұрын
fantastic!
@carlosarrieta1145
@carlosarrieta1145 3 жыл бұрын
in which IDLE are you runing your code?
@QuantPy
@QuantPy 3 жыл бұрын
This is Jupyter Lab (notebooks) for python. If you’re using straight IDE, I like to use Visual Studio Code 👍
@ncheymbamalu4013
@ncheymbamalu4013 3 жыл бұрын
Stock returns and log returns can be modeled more accurately with the t-distribution.
@sahilharidas4747
@sahilharidas4747 2 жыл бұрын
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.
@wilsongomes3360
@wilsongomes3360 2 жыл бұрын
good job. tks
@vladk9152
@vladk9152 3 жыл бұрын
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?
@TheMLPRyan
@TheMLPRyan 3 жыл бұрын
Yes keep the rare events, have a look at what happened to LTCM when they didn’t include large deviations from their models.
@steez54321
@steez54321 2 жыл бұрын
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?
@QuantPy
@QuantPy 2 жыл бұрын
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
@steez54321
@steez54321 2 жыл бұрын
@@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?
@omololaomotalade8105
@omololaomotalade8105 2 жыл бұрын
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.
@jure4835
@jure4835 3 жыл бұрын
Doesn't this basically show that log returns are normally distributed and therefore the stock returns have a lognormal distribution?
@QuantPy
@QuantPy 3 жыл бұрын
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
@shaaf9817
@shaaf9817 3 жыл бұрын
Do some videos on crypto
@ooddy24
@ooddy24 3 жыл бұрын
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...
@QuantPy
@QuantPy 3 жыл бұрын
Thanks Manit, all code on my website in the link in the description if you’ve missed anything 👍
@MA-oj8zk
@MA-oj8zk Жыл бұрын
For those running into issues with the yahoofinance pandareader, here's the fix: import yfinance as yf yf.pdr_override()
Why are Stock Prices Lognormal?
12:28
Options A to Z - Facebook Trading Group
Рет қаралды 7 М.
Муж внезапно вернулся домой @Oscar_elteacher
00:43
История одного вокалиста
Рет қаралды 8 МЛН
From Small To Giant 0%🍫 VS 100%🍫 #katebrush #shorts #gummy
00:19
Lazy days…
00:24
Anwar Jibawi
Рет қаралды 8 МЛН
Accompanying my daughter to practice dance is so annoying #funny #cute#comedy
00:17
Funny daughter's daily life
Рет қаралды 26 МЛН
Log Returns in Finance: Continuous Compounding and Euler's Number (e) Explained
14:04
Can You Compare Intraday Volatility Surfaces?
24:27
QuantPy
Рет қаралды 14 М.
The Lognormal Model of Stock Prices
9:36
Mike, the Mathematician
Рет қаралды 1,7 М.
Why we use Ln returns in finance
10:42
Michael Ward
Рет қаралды 21 М.
Probability Distribution, Statistics - Algorithmic Trading
10:52
QuantProgram
Рет қаралды 102 М.
Муж внезапно вернулся домой @Oscar_elteacher
00:43
История одного вокалиста
Рет қаралды 8 МЛН