字幕表 動画を再生する
Okay, great.
Let's continue where we left off.
In our previous video, we obtain the drift and standard deviation values we will need for the calculations of daily returns.
The type function allows us to check their type and see it is panda Siri's.
To proceed with our task, we should convert these values into numb pie raise.
You already know that numb pies array method can do this for us.
However, let me demonstrate how typing dot values after a panda's object, Beata Siri's or a data frame can transfer the object into a numb pie array.
You see, we obtain the same output for the drift as we did with numb pi dot array.
Then STD of DOT values provides an anna logical output and allows us to obtain the standard deviation.
Great.
The second component of the brownie in motion is a random variable z, a number corresponding to the distance between the mean and the events expressed a CZ.
The number of standard deviations seif eyes norm dot PPF allows us to obtain this result.
If an event has a 95% chance of occurring, the distance between this event and the mean will be approximately 1.65 Standard deviations.
Okay, this is how it works.
To complete the second component, we will need to randomize the well known numb Pie Rand function can help us do that easily.
If we want to create a multi dimensional array, we will need to insert two arguments.
So all type 10 and two.
Here you go.
We obtained a 10 by two matrix.
We will include this random element within the PPF distribution to obtain the distance from the mean corresponding to each of these randomly generated probabilities.
The first number from the first row corresponds to the first probability from the first row of the X matrix, the second element to the second probability as shown in the X matrix and so on.
Great.
The whole expression corresponding to Z will be of the type norm PPF open parenthesis, numb pie, random ran open another parenthesis 10 and to close all parentheses.
The newly created array used the probabilities generated by the rand function and converted them into distances from the mean zero as measured by the number of standard deviations.
This expression will create the value of Z as defined in our formula cool.
So once we have built these tools and calculated all necessary variables, we are ready to calculate daily returns.
All the infrastructure is in place.
Okay, So first I would like to specify the time intervals we will use will be 1000.
Because we're interested in forecasting the stock price for the upcoming 1000 days.
Then two generations.
I will attribute the value of 10 which means I will ask the computer to produce Tin Siri's of future stock price predictions.
Okay, the variable daily returns will show us what will equal e to the power of our We discussed this in the theoretical lesson.
Remember, we will need numb pies, e x p function, which means we are calculating Oilers number E raised to the power of the expression written between the parentheses in the parentheses.
We will have the value of the drift in the product of a standard deviation and the random component created with the help of the norm module.
It's percentage value is generated with numb pies, rand function using time intervals and generations specifying the dimensions of the array filled with values from 0 to 1.
Great.
So the formula we used in the previous cell would allow us to obtain a 1000 by 10 array with daily return values 10 sets of 1000 random future stock prices.
Great.
We are a single step away from completing this exercise will do that in our next lecture.
Thanks for watching.