Monte Carlo Simulation to Predict Stock Prices | R

  Рет қаралды 12,413

quantRoom

quantRoom

Күн бұрын

Пікірлер: 42
@marcoesteves4367
@marcoesteves4367 3 жыл бұрын
Hi Jason, great work here. I revisited this approach with a 10 days window to calculate de standard deviation "more accurate". It really improved the results. Thanks for your job.
@quantroom
@quantroom 3 жыл бұрын
Excellent & thanks for sharing!
@esteban_ruiz
@esteban_ruiz 3 жыл бұрын
R is awesome for MC simulation but I also suggest C++ for speedier simulations and HFT ;)
@caitlinmccormick8135
@caitlinmccormick8135 7 ай бұрын
Hiya, what particular Monte Carlo Simulation method would you say you have used here?
@quantroom
@quantroom Ай бұрын
Don't recall the exact method.
@RIDICULOUSLOGIN
@RIDICULOUSLOGIN 4 жыл бұрын
That's a great tutorial. Could you post the results?
@quantroom
@quantroom 4 жыл бұрын
Yes I will post them here under the description & on social media.
@joselouisiparraguirre6473
@joselouisiparraguirre6473 2 жыл бұрын
Hi Jason, Just bumped into this video. Great job! One question: do we need to simulate the volatility as well? If it happens that a GARCH model with an asymmetric distribution fits the time series better, must we use that distribution (say, a skewed Student's t) instead of qnorm or not? Regards
@quantroom
@quantroom 2 жыл бұрын
Thank you for your comment. I think your question may be a little too advanced for me, but maybe someone with more experience may answer it here. You can also try posting a question on StackOverflow to see if they can answer it there.
@joselouisiparraguirre6473
@joselouisiparraguirre6473 2 жыл бұрын
@@quantroom Many thanks Jason. I'll do
@mindfreak9352
@mindfreak9352 2 жыл бұрын
Hi Jason, question at min. 19:35 How to interpret the plot at index of 50? Does it mean: With a probability of 50% the end price (or closing price) of the stock will be at average $ 100? Thank you.
@quantroom
@quantroom 2 жыл бұрын
The X axis serves as the position/location of the data points. It is not meaningful to the Monte Carlo Simulation. I just created the plot to visualize the "bands" above/below where the "End.PRC" for the stock.
@bored1315
@bored1315 3 жыл бұрын
Hi The simulation is stuck on 99% for a long time and returned this: Error in quantile.default(stock_prices, probs = seq(0, 1, 0.05)) : missing values and NaN's not allowed if 'na.rm' is FALSE In addition: There were 50 or more warnings (use warnings() to see the first 50) Could you give an update please? Thanks
@quantroom
@quantroom 3 жыл бұрын
try adding na.rm in the quantile function: *quantile.default(stock_prices, probs = seq(0, 1, 0.05), na.rm=TRUE)* but also check the data to verify it is complete i.e. without NAs
@bored1315
@bored1315 3 жыл бұрын
@@quantroom Its worked, thanks again 👍
@eduardopossealvarez7717
@eduardopossealvarez7717 3 жыл бұрын
Great video Jason. Please, May you tell me why it is needed to multiply the mean by delta_t and the variance by the square of delta_t in the qnorm distribution? Why delta_t must be1/N, that is, greater for shorter periods? Thank you
@quantroom
@quantroom 3 жыл бұрын
Thanks Eduardo! We multiply by delta_t to give it weight/standardize such that a STDEV of 20% & mean of 0.005 across a 20-day period (1/20) would yield a lower result since it spread over the 20 days than having the same 20% STDEV in say 1 day (or 1/1) that is why it becomes greater for shorter periods. I may be wrong, so anyone feel free to correct me here.
@eduardopossealvarez7717
@eduardopossealvarez7717 3 жыл бұрын
@@quantroom thank you
@dustinsmith8390
@dustinsmith8390 3 жыл бұрын
How would you go about alerting the script, so you would be looking ahead say a week or month? Currently, the last row in my dataframe "p" is tomorrows date.
@quantroom
@quantroom 3 жыл бұрын
You would have to modify the EXPIRY variable to the dates you want. You can use seq.Date() to create a date vector spaced out in Weeks or Months.
@dustinsmith8390
@dustinsmith8390 3 жыл бұрын
@@quantroom Thanks for the reply! As far as forecasting/looking into the future. Say, if I want to look in the future next week, two weeks, so on, would I adjust the NEXT.EXPIRY variable?
@JonesDawg
@JonesDawg 4 жыл бұрын
This is great, thanks!
@morganfuller5314
@morganfuller5314 3 жыл бұрын
The STK_PRC comes up as numeric(empty) when I run the code and this leads to the monte carlo simulation coming up with an error. How do I correct this or why is this happening?
@quantroom
@quantroom 3 жыл бұрын
Try running the code using my script to see if you get the same error. You can get the link to the script in the description area.
@morganfuller5314
@morganfuller5314 3 жыл бұрын
@@quantroom Thanks for the reply Jason! I ran your code and now get the error 'Error in quantile.default(stock_prices, probs = seq(0, 1, 0.05)) : missing values and NaN's not allowed if 'na.rm' is FALSE' after running the Monte Carlo assigned to variable p. Any ideas of how to solve this?
@aniafistasz3k398
@aniafistasz3k398 2 жыл бұрын
@@morganfuller5314 Hello I have the same problem :(
@richaka
@richaka 4 жыл бұрын
Hey Jason, great work man, i tried to replicate your code, however, at p
@quantroom
@quantroom 4 жыл бұрын
Thank You! Check out 18:06 i think you may have accidentally copied it wrong. Try using p
@richaka
@richaka 4 жыл бұрын
@@quantroom, thank you, I found where the bug was. In my MonteCarlo simulation function,i had misspelled one of the objects.
@fearingz
@fearingz 4 жыл бұрын
Great tutorial!
@quantroom
@quantroom 4 жыл бұрын
Thank you!
@fearingz
@fearingz 4 жыл бұрын
@@quantroom Is it possible to change the code so that I can evaluate my own xts file with historical values? I would like to do some tests with it towards the lehman crisis and corona crisis. (For the university)
@quantroom
@quantroom 4 жыл бұрын
@@fearingz I believe you can use your own data just replace the stock variable
@jmagomez1
@jmagomez1 3 жыл бұрын
Dear Jason, congrats for this video! I tried to replicate your code, but i got this message at the end, what could I do before at the code to avoid this message? Thanks! > p
@quantroom
@quantroom 3 жыл бұрын
Thanks for the comment. It looks like you may have some NAs in your data that are triggering the error.
R Finance: Monte Carlo Simulations
16:17
Chessability
Рет қаралды 5 М.
6. Monte Carlo Simulation
50:05
MIT OpenCourseWare
Рет қаралды 2 МЛН
За кого болели?😂
00:18
МЯТНАЯ ФАНТА
Рет қаралды 3,3 МЛН
Thank you Santa
00:13
Nadir Show
Рет қаралды 41 МЛН
Monte Carlo Simulation
10:06
MarbleScience
Рет қаралды 1,4 МЛН
Monte Carlo Simulation For Any Model in Excel - A Step-by-Step Guide
20:07
Monte Carlo Prediction
10:38
Siraj Raval
Рет қаралды 63 М.
Forecasting Bitcoin Prices using Prophet in R
6:43
Justin Eloriaga
Рет қаралды 18 М.
MONTE CARLO SIMULATION EXAMPLES IN R (BASIC EXAMPLES)
15:19
Analytics University
Рет қаралды 3,6 М.
Using Monte Carlo simulations for valuation
9:53
Financial Analysis with Dr Jeff
Рет қаралды 19 М.
What is Monte Carlo Simulation?
4:35
IBM Technology
Рет қаралды 291 М.
За кого болели?😂
00:18
МЯТНАЯ ФАНТА
Рет қаралды 3,3 МЛН