Afrikaans
Akan
Albanian
Amharic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
OK, so in this lecture, you're going to look at a simple example of how to simulate stock prices,
assuming that the log returns come from a normal distribution.
Now, this might seem at first to be a strange exercise, but it should get you thinking.
We'll see how totally unpredictable randomness can lead to something that looks very much like a stock
race time series.
In fact, this exact method can be used for doing Montecarlo simulations and evaluating the Black-Scholes
formula.
Furthermore, it is also useful for when we want to analyze certain rules of thumb for Arima.
This may not make too much sense right now, but you'll see how this kind of approach can help to validate
some of the rules that we use for a rhema model selection.
OK, so let's start by importing nonpaying matplotlib.
The next step is to set a few constants will be using, such as the number of time steps, the initial
price and the drift term.
The next step is to run our simulation, so we'll start by taking the log of the price and setting it
to last P last P is a variable will continue to update throughout the loop, since the current price
will always depend on the last price.
The next step is to create two arrays, to store log returns and our prices, and of course, these
should both have length T.
The next step is to enter a loop that goes 40 iterations inside the loop.
We'll start by sampling a random log return from a zero mean normal distribution with standard deviation
zero point zero one.
The next step is to compute our new log price.
This is equal to the old log price, plus the drifter, plus the random noise.
The next step is to store the log return and the new price note that we don't actually make use of the
log returns, but you may find them to be useful in later code for the price.
Note that we have to take the exponential since we want to plot the price and not the log price.
The final step in this loop is to assign P to last P so that last P has the correct value in the next
iteration.
OK, and so in the next block, we are going to plot our simulated time series.
So as you can see, this certainly looks like a plausible stock price evolution in the coming lectures,
you learn about the why behind what we just did.
And hopefully this will give you some insight behind this exercise.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.