Monte Carlo: Forecasting Stock Prices Part I
Key Takeaways
This video demonstrates how to apply Monte Carlo simulations to forecast stock prices using Python, specifically using libraries such as NumPy, Pandas, and Matplotlib. The example uses P&G's historical stock price data to estimate log returns and calculate the drift component and standard deviation of log returns.
Full Transcript
okay perfect in this lesson we'll continue to explore how Monte Carlo simulations can be applied in practice in particular we will see how we can run a simulation when trying to predict the future stock price of a company there is a group of libraries and modules that can be imported when carrying out this task but the good news is you have already used all of them besides the classical numpy and pandas we will need norm from Sify and some specific matplotlib features once again the company we will use for our analysis will be P&G the timeframe under consideration reflects the past 10 years starting from January the 1st 2007 we want to forecast P and G's future stock price in this exercise so the first thing we'll do is estimate its historical log returns there is a second way to obtain simple or logarithmic returns and we will discuss it in more detail in the notebook document attached to this video the method will apply here is called percent change and you must write percent underscore change open and close parentheses to obtain the simple returns from a provided data set we can create the formula for log returns by using num pies log and then type 1 plus the simple returns extracted from our data and here's a table with P G's log returns awesome in the first graph we can see P and G's price which has been gradually growing during the past decade in the second one we plot the log returns not the price of P&G the picture tells us the returns are normally distributed and have a stable mean great now let's explore their mean and variance as we will need them for the calculation of the Brownian motion we talked about in our previous lecture remember we already know how to calculate mean and variance don't we after a few lines of code we obtained these numbers so what are we going to do with them first I'll compute the drift component we studied in our previous lecture it is the best approximation of future rates of return of the stock the formula to use here will be U which equals the average log return minus half its variance all right we obtained a tiny number and that need not scare you because we'll do this entire exercise without annualizing our indicators why because we will try to predict pn G's daily stock price good next we will create a variable called st dev and we will assign to it the standard deviation of log returns we said the Brownian motion comprises the Sun of the drift and standard deviation of adjusted by e to the power of r so we will use this block in the second part of the expression okay we've set up the first Brownian motion element in our simulation in the next lesson we will create the second component and we'll show you how this would allow us to run a simulation about a firm's future stock price
Original Description
👉🏻 Download Our Free Data Science Career Guide: https://bit.ly/3kJFYZd
👉🏻 Sign up for Our Complete Data Science Training with 57% OFF: https://bit.ly/3aoM4JL
In the Monte Carlo: Forecasting Stock Prices Part I you will learn how to apply a Monte Carlo simulation using Python.
Вe'll continue to explore how Monte Carlo simulations can be applied in practice. Иn particular we will see how we can run a simulation when trying to predict the future stock price of a company. Тhere is a group of libraries and modules that can be imported when carrying out this task but the good news is you have already used all of them. Besides the classical numpy and pandas we will need norm from Sify and some specific matplotlib features.
► Consider hitting the SUBSCRIBE button if you LIKE the content: https://www.youtube.com/c/365DataScience?sub_confirmation=1
► VISIT our website: https://bit.ly/365ds
🤝 Connect with us LinkedIn: https://www.linkedin.com/company/365datascience/
365 Data Science is an online educational career website that offers the incredible opportunity to find your way into the data science world no matter your previous knowledge and experience. We have prepared numerous courses that suit the needs of aspiring BI analysts, Data analysts and Data scientists.
We at 365 Data Science are committed educators who believe that curiosity should not be hindered by inability to access good learning resources. This is why we focus all our efforts on creating high-quality educational content which anyone can access online.
Check out our Data Science Career guides: https://www.youtube.com/playlist?list=PLaFfQroTgZnyQFq4nUfb-w2vEopN3ULMb
#MonteCarlo #Forecasting #Stocks
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from 365 Data Science · 365 Data Science · 24 of 60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
▶
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Population vs Sample
365 Data Science
Data Science & Statistics: Levels of measurement
365 Data Science
Statistics Tutorials: Mean, median and mode
365 Data Science
Skewness
365 Data Science
What is a distribution?
365 Data Science
The Normal Distribution
365 Data Science
Central limit theorem
365 Data Science
Student's T Distribution
365 Data Science
Type I error vs Type II error
365 Data Science
Hypothesis testing. Null vs alternative
365 Data Science
The linear regression model
365 Data Science
Simple linear regression model. Geometrical representation
365 Data Science
INDEX and MATCH application of the two functions separately and combined [Advanced Excel]
365 Data Science
INDIRECT Excel Function: How it works and when to use it [Advanced Excel]
365 Data Science
VLOOKUP and MATCH another useful functions combination [Advanced Excel]
365 Data Science
VLOOKUP COLUMN and ROW - Handle large data tables with ease [Advanced Excel]
365 Data Science
The ELIF keyword [Python Fundamentals]
365 Data Science
Working with Tuples in Python
365 Data Science
Database Terminology - A Beginners Guide
365 Data Science
Relational Database Essentials
365 Data Science
Database vs Spreadsheet - Advantages and Disadvantages
365 Data Science
Conditional Statements and Loops
365 Data Science
Backpropagation – The Math Behind Optimization
365 Data Science
Monte Carlo: Forecasting Stock Prices Part I
365 Data Science
Monte Carlo: Forecasting Stock Prices Part II
365 Data Science
Monte Carlo: Forecasting Stock Prices Part III
365 Data Science
365 Data Science Online Program
365 Data Science
Data frames - Creating a data frame
365 Data Science
Data Science & Statistics: Slicing a matrix in R
365 Data Science
Data frames in R - Exporting data in R
365 Data Science
Data frames in R - Transforming data PART II
365 Data Science
Data Frames in R - Subsetting a data frame
365 Data Science
Data Science & Statistics: Matrix arithmetic in R
365 Data Science
Data Science & Statistics: Indexing an element from a matrix
365 Data Science
Data Frames in R - Extending a data frame
365 Data Science
Data Science & Statistics: Creating a matrix in R FASTER
365 Data Science
Data Science & Statistics: Creating a Matrix in R
365 Data Science
Data frames - Importing data in R
365 Data Science
Data frames in R - Getting a sense of your data
365 Data Science
Data frames in R - Transforming data PART I
365 Data Science
Data frames in R - Import a CSV in R
365 Data Science
Data Science & Statistics: Matrix operations in R
365 Data Science
Data Science & Statistics: Matrix recycling in R
365 Data Science
Tableau vs Excel: When to use Tableau and when to use Excel
365 Data Science
Download Tableau: Learn how to download Tableau Public
365 Data Science
Connecting data sources: Useful tips when connecting data sources to Tableau
365 Data Science
The Tableau interface: See how to navigate through the Tableau interface
365 Data Science
Tableau data visualization: Create your first Tableau visualization!
365 Data Science
Duplicating sheets: This is how to duplicate a sheet in Tableau
365 Data Science
Build a table in Tableau: The steps needed to create a simple table in Tableau
365 Data Science
Custom fields in Tableau: Using Tableau operators to create custom fields
365 Data Science
Custom fields in Tableau: Add calculations to tables through custom fields
365 Data Science
Totals in Tableau: Learn how to display subtotals and totals in Tableau
365 Data Science
Gross Margin calculation in Tableau
365 Data Science
What is a filter in Tableau: Set up a filter in Tableau to specify the data you want to show
365 Data Science
Joins in Tableau: Inner, outer, left, or a right join in Tableau
365 Data Science
Building a Tableau dashboard: Three types of charts you want to have in a Tableau dashboard
365 Data Science
Creating great looking charts in Tableau: Real life Exercise on charts in Tableau
365 Data Science
Joins in Tableau: Choose the correct join type
365 Data Science
How to make a data check in Tableau: A quick data check is better than no data check
365 Data Science
More on: Python for Data
View skill →Related AI Lessons
⚡
⚡
⚡
⚡
AI: Energy Taker or Energy Maker
Medium · AI
When AI Asks for More Electricity Than a Country Can Imagine
Medium · AI
You Are Not Behind. The World Is.
Medium · AI
Career choice with the advent of AI - pure Computer Science or learn software with a background of core engineering area
Dev.to AI
🎓
Tutor Explanation
DeepCamp AI