##Introduction to time-series variables
In this section we will download time-series variables from Yahoo Finance and explore the time-series datasets, more specifically, we explore the xts-zoo R objects. xts stands for “Extensible time series”, and zoo is an R class for general time-series datasets.
XTS -> EXTENSIBLE TIME SERIES. ZOO -> R CLASS FOR GENERAL TIME-SERIES DATASETS.
We start clearing our R environment:
rm(list=ls())
# To avoid scientific notation for numbers:
options(scipen=999)
Install the quantmod package
In order to import and manage financial data in R, the quantmod package must be installed. This package contains the getSymbols() function, which creates an xts (extensible time series) object in the environment with the downloaded data from the Internet. In order to install packages in R, go to the Package tab in the bottom-right section of RStudio, select Install and then type quantmod, and the botton Install.
Now, you have installed a package and it is not necessary to install it again in further occasions. It will stay in your computer. However, next time you want to use it, you have to load it using the library() function
QUANTMOD -> IMPORT AND MANAGE FINANCIAL DATA IN R GETSYMBOLS FUNCTION -> CREATES AN XTS OBJECT IN THE ENVIRONMENT WITH THE DATA FROM THE WEB. The getSymbols() function enables its user to download online and up-to-date financial data, such as stock prices, market indexes, ETF prices, interest rates, exchange rates, etc. getSymbols() allows to download this data from Yahoo Finance, Oanda, and FRED. These sources have thousands of finance and economic data series from many market exchanges and other macroeconomic variables around the world.
library(quantmod)
## Loading required package: xts
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
## Loading required package: TTR
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
Downloading the IPyC and the S&P market indexes
We will work with the Mexican market index, the IPyC, and the US market index, the S&P500.
What is a market index?
A market index in a financial market is a virtual portfolio composed by a group of public firms that issue shares in that market. There are different market indexes in each financial market. The most important market index in Mexico is the Índice de Precios y Cotizaciones, or IPyC. In the US financial market, one of the most important market indexes is the Standard & Poors 500 index, or S&P500.
The IPyC index tries to emulate a virtual portfolio with the biggest 35 public firms in the Mexican market. The weight (%) assign for each firm in the virtual portfolio is actually the market size of each firm. Then, the biggest the firm, the highest its weight in the IPyC portfolio.
The S&P500 index tries to emulate a virtual portfolio with the biggest 500 public firms in the US market. The weight (%) assign for each firm in the virtual portfolio is actually the market size of each firm. Then, the biggest the firm, the highest its weight in the S&P500 portfolio.
Both indexes are tracked every day in their respective financial markets, so we can get access to their current and historical daily values from different sources.
We download the monthly IPyC and S&P500 from Yahoo Finance from 2011 to date:
getSymbols(Symbols= c("^MXX", "^GSPC"), from="2011-01-01",
periodicity = "monthly", src = "yahoo")
## 'getSymbols' currently uses auto.assign=TRUE by default, but will
## use auto.assign=FALSE in 0.5-0. You will still be able to use
## 'loadSymbols' to automatically load data. getOption("getSymbols.env")
## and getOption("getSymbols.auto.assign") will still be checked for
## alternate defaults.
##
## This message is shown once per session and may be disabled by setting
## options("getSymbols.warning4.0"=FALSE). See ?getSymbols for details.
## [1] "^MXX" "^GSPC"
In Yahoo Finance the unique identifier (also called ticker) for the IPyC is ^MXX, and the ticker for the S&P500 is ^GSPC (General S&P Composite).
In this case the getSymbols function creates 2 datasets with the historical data of these 2 indexes. Each dataset is an xts-zoo R object with historical monthly quotations in a chronological order. These xts-zoo R objects are actually datasets with the values for the market indexes, and with a time index.
Each R object has at specific class. In this case, the class of these datasets is called xts-zoo. xts stands for extensible time-series. An xts-zoo object is designed to easily manipulate time series data.
For each period, Yahoo Finance keeps track of the open, high, low, close (OHLC) and adjusted prices. Also, it keeps track of volume that was traded (# of shares traded) in every specific period. The adjusted prices are used for stocks, not for market indexes. Adjusted prices consider dividend payments and stock splits. For the case of market indexes, the adjusted prices are always equal to the close prices.
Merging time-series datasets
We can integrate xts-zoo R objects into one xts-zoo dataset using the merge function. In this case, we only use the adjusted price, so we can also use the Ad function:
# We merge the datasets into a new R object called prices:
prices = merge(MXX,GSPC)
# We only keep the adjusted price columns:
prices = Ad(prices)
# We rename the columns with simpler names:
names(prices) = c("MXX","GSPC")
Q Visualizing time-series variables
For each index we do a graph to visualize how the index moves over time. We can use the chartSeries function from the quantmod package:
chartSeries(MXX, theme=("black"))
chartSeries(GSPC, theme=("black"))
Respond to the following QUESTIONS:
WHAT YOU CAN SAY ABOUT THE TREND OF BOTH MARKET INDEXES? IS IT CONSTANTLY GROWING, OR DECLINING, OR THERE IS NO CLEAR TREND? BRIEFLY EXPLAIN
FOR THE VERY SECOND GRAPH, THE S&P500, WE CAN CLEARLY APPRECIATE A BULLISH TREND; WHERE SINCE 2011 IT HASN’T STOPPED GROWING, EVEN CONSIDERING THE PANDEMIC AND THE ECONOMIC AFTERMATH. ON THE OTHER HAND, AS WE CAN SEE IN THE MEXICAN IPyC INDEX, THE BULLISH TREND WAS ALSO PRESENT UNTIL 2018, WHERE THE MARKET STARTED TO FALL (DUE TO THE CANCELATION OF THE NEW AIRPORT) AND THE PANDEMIC ENDED BY COLLAPSING THE MARKET. NEVERTHELESS, SINCE 202O, THE MARKET HAS RECOVERED PART OF ITS BULLISH TREND AND HAS ALREADY BREAK THE RESISTANCE AT 4,500.
Reviewing the concept of natural logarithm
Generate a new dataset with the natural logarithm (log) of the indexes:
lnprices = log(prices)
Now do a time plot for the natural log price of the MXX:
plot(lnprices$MXX, main = "Log of the Mexican Index over time")
plot(lnprices$GSPC, main = "Log of the American Index over time")
What is a natural logarithm?
The natural logarithm of a number is the exponent that the number e (=2.71…) needs to be raised to get another number. For example, let’s name x=natural logarithm of a stock price p. Then:
\[e^x=p\] The way to get the value of x that satisfies this equality is actually getting the natural log of p:
\[x=log_e(p)\] Then, we have to remember that the natural logarithm is actually an exponent that you need to raise the number e to get a specific number.
The natural log is the logarithm of base e (=2.71…). The number e is an irrational number (it cannot be expressed as a division of 2 natural numbers), and it is also called the Euler constant. Leonard Euler (1707-1783) took the idea of the logarithm from the great mathematician Jacob Bernoulli, and discovered very astonishing features of the e number. Euler is considered the most productive mathematician of all times. It is interesting to know that Jacob Bernoulli discovered the number e (around 1690) when he was playing with calculations to know how a financial amount grows over time.
How e is related to the grow of financial amounts over time?
Here is a simple example:
If I invest $100.00 with an annual interest rate of 50%, then the end balance of my investment at the end of the first year (at the beginning of year 2) will be:
\[l_2 = 100 * (1+0.50)^1\] If the interest rate is 100%, then I would get:
\[l_2 = 100 * (1+1)^1\] Then, the general formula to get the final amount of my investment at the beginning of year 2, for any interest rate R can be:
\[l_2 = l_1 * (1+R)^1\] The (1+R) is the growth factor of my investment.
In Finance, the investment amount is called principal. If the interests are calculated (compounded) each month instead of each year, then I would end up with a higher amount at the end of the year.
Monthly compounding means that a monthly interest rate is applied to the amount to get the interest of the month, and then the interest of the month is added to the investment (principal). Then, for month 2 the principal will be higher than the initial investment. At the end of month 2 the interest will be calculated using the updated principal amount. Putting in simple math terms, the final balance of an investment at the beginning of year 2 when doing monthly compounding will be:
\[l_2 = l_1*(1+\frac{R}{N})^{1*N}\] For monthly compounding, N=12, so the monthly interest rate is equal to the annual interest rate R divided by N (R/N). Then, with an annual rate of 100% and monthly compounding (N=12):
\[l_2 = 100*(1+\frac{1}{12})^{1*12}=100*(2.613...)\] In this case, the growth factor is \((1+1/12)^{12}\), which is equal to 2.613.
Instead of compounding each month, if the compounding is every moment, then we are doing a continuously compounded rate.
If we do a continuously compounding for the previous example, then the growth factor for one year becomes the astonishing Euler constant e:
Let’s do an example for a compounding of each second (1 year has 31,536,000 seconds). The investment at the end of the year 1 (or at the beginning of year 2) will be:
\[l_2 = 100*(1+\frac{1}{31536000})^{1*31536000}=100*(2.7182)\cong 100*e^1\] Now we see that \(e^1\) is the GROWTH FACTOR after 1 year if we do the compounding of the interests every moment!
We can generalize to any other annual interest rate R, so that \(e^R\) is the growth factor for an annual nominal rate R when the interests are compounded every moment.
When compounding every instant, we use small r instead of R for the interest rate. Then, the growth factor will be: \(e^r\)
Then we can do a relationship between this growth rate and an effective equivalent rate:
\[(1+EffectiveRate)=e^r\] If we apply the natural logarithm to both sides of the equation:
\[ln(1+EffectiveRate)= ln(e^r)\] Since the natural logarithm function is the inverse of the exponential function, then:
\[ln(1+EffectiveRate)= r\] In the previous example with a nominal rate of 100%, when doing a continuously compounding, then the effective rate will be:
\[(1+EffectiveRate) = e^r = 2.7182\] \[EffectiveRate=e^r-1\] Doing the calculation of the effective rate for this example:
\[EffectiveRate=e^1-1=2.7182-1=1.7182=171.82%\] Then, when compounding every moment, starting with a nominal rate of 100% annual interest rate, the actual effective annual rate would be 171.82%!
Financial returns
A financial simple return for a stock (Rt) is calculated as a percentage change of price from the previous period (t-1) to the present period (t):
\[R_{t}=\frac{Adjprice_{t}-Adjprice_{t-1}}{Adjprice_{t-1}}=\frac{Adjprice_{t}}{Adjprice_{t-1}}-1\] For example, if the adjusted price of a stock at the end of January 2021 was $100.00, and its previous (December 2020) adjusted price was $80.00, then the monthly simple return of the stock in January 2021 will be:
\[R_{Jan2021}=\frac{Adprice_{Jan2021}}{Adprice_{Dec2020}}-1=\frac{100}{80}-1=0.25\] We can use returns in decimal or in percentage (multiplying by 100). We will keep using decimals.
In Finance it is very recommended to calculate continuously compounded returns (cc returns) and using cc returns instead of simple returns for data analysis, statistics and econometric models. cc returns are also called log returns.
One way to calculate cc returns is by subtracting the log of the current adjusted price (at t) minus the log of the previous adjusted price (at t-1):
\[r_{t}=log(Adjprice_{t})-log(Adjprice_{t-1})\] This is also called as the difference of the log of the price.
We can also calculate cc returns as the log of the current adjusted price (at t) divided by the previous adjusted price (at t-1):
\[r_{t}=log(\frac{Adjprice_{t}}{Adjprice_{t-1}})\] cc returns are usually represented by small r, while simple returns are represented by capital R.
Calculation of financial returns
It is recommended to always use adjusted prices to calculate financial returns. In this example that we have market indexes, the adjusted price is exactly the same as the closing price since market indexes do not have stock splits nor dividend payments.
We can use the lag function to get past (lagged) values of a time-series dataset (or column). With this function we can get the price of the previous period to calculate the simple return. Let’s create a new dataset for the simple monthly returns of both indexes:
R = prices / lag(prices,n=1) - 1
Let’s create a new variable for the cc return for both indexes. Remember that the continuously compounded returns can be calculated as the difference between the log of the price of today minus the log of the price of the previous period:
r = log(prices) - lag(log(prices),n=1)
We can also use the function diff, which calculates the first difference of any time-series variable:
r= diff(log(prices))
We get the same result using any of these 2 calculations, but it seems easier to use the diff function.
Now do a time plot for the cc returns of the Mexican index:
plot(r$MXX, col = "darkblue",
main = "cc return for the MXX index")
plot(r$GSPC, col = "darkblue",
main = "cc return for the GSPC index")
summary(r$MXX)
## Index MXX
## Min. :2011-01-01 Min. :-0.178912
## 1st Qu.:2013-08-08 1st Qu.:-0.017024
## Median :2016-03-16 Median : 0.005350
## Mean :2016-03-16 Mean : 0.002287
## 3rd Qu.:2018-10-24 3rd Qu.: 0.022078
## Max. :2021-05-14 Max. : 0.121801
## NA's :1
BRIEFLY RESPOND TO THE FOLLOWING AFTER LOOKING TO THE PREVIOUS PLOT (MXX):
SÍ. COMO PODEMOS VER, LA SERIE DE TIEMPO MANTIENE EL MISMO VALOR ESPERADO A LO LARGO DEL TIEMPO RESPECTO A SU MEDIA. TRAS HABER CONVERTIDO LOS RETORNOS SIMPLES EN RETORNOS CONTINUOS COMPUESTOS, LA SERIE DE TIEMPO CUMPLE CON LA CONDICIONES NECESARIAS PARA SER UNA SERIE ESTACIONARIA, Y POR LO TANTO, INDICARNOS UNA MEDIA APROXIMADAMENTE IGUAL PARA TODOS LOS PERIODOS EN CUESTIÓN.
SÍ.EN CUANTO A LA VOLATILIDAD DEL ACTIVO, PODEMOS VER QUE LA VARIANZA TAMBIÉN ES CONSTANTE PARA LA MAYORÍA DE LOS PERIODOS DE TIEMPO, EXCEPTO PARA ALGUNOS PERÍODOS QUE MUESTRAN ALTA VOLATILIDAD.
Non stationary variables - The Random Walk model for stock prices
The random walk hypothesis in Finance (Fama, 1965) states that the natural logarithm of daily stock prices behaves like a random walk with a drift. A random walk is a series (or variable) that cannot be predicted. Imagine that Yt is the log price of a stock for today (t). The value of Y for tomorrow (Yt+1) will be equal to its today’s value (Yt) plus a constant value (φ0) plus a random shock. This shock is a pure random value that follows a normal distribution with mean=0 and a specific standard deviation σε. The process is supposed to be the same for all future periods. In mathematical terms, the random walk model is the following:
\[Y_{t}=\varphi _{0}+Y_{t-1}+\varepsilon _{t}\] The εt is a random shock for each day, which follows a normal probability distribution with mean=0 and with a specific standard deviation σϵ:
\[\varepsilon _{t}\sim N(\mu =0,\sigma =\sigma _{\varepsilon })\] The εt or random shock for day t is the result of the all news (external and internal to the stock) of that day t. This shock directly influence the %change in the stock price in day t.
φ0 refers as the drift of the series. If |φ0| > 0 we say that the series is a random walk with a drift. If φ0 is positive, then the variable will have a positive trend over time; if it is negative, the series will have a negative trend. If we want to simulate a random walk, we need the values of the following parameters/variables:
Y0, the first value of the series
φ0, the drift of the series
σε, the standard deviation (volatility) of the random shock
Q Monte Carlo simulation for the random walk model
Let’s go and do a Monte Carlo simulation for a random walk with drift that tries to behave like the S&P 500 index. We will use real historical daily values of the S&P500 to estimate the previous 3 parameters.
We need to download daily data for the S&P500 index (instead of monthly). We will download data since 2009:
getSymbols("^GSPC", from="2009-01-01")
## [1] "^GSPC"
Since we did not specify the frequency, we downloaded daily data.
Now we generate the log of the S&P index using the closing price/quotation, and create a variable N for the number of days in the dataset:
lnsp<-log(Ad(GSPC))
# I assign a name for the column:
names(lnsp)<-c("lnsp")
# We get the # of rows of the lnsp series:
N<-nrow(lnsp)
Now we will simulate 2 random walk series:
a random walk with a drift (name it rw1), and
a random walk with no drift (name it rw2).
Estimating the parameters of the random walk model
We have to consider the mathematical definition of a random walk and estimate its parameters (initial value, phi0, volatility of the random shock) from the real daily S&P500 data.
Reviewing the random walk equation again:
\[Y_{t}=\varphi _{0}+Y_{t-1}+\varepsilon _{t}\] The εt is the random shock of each day, which represents the overall average perception of all market participants after learning the news of the day (internal and external news announced to the market).
Remember that εt behaves like a random variable with normal probability distribution with mean=0 and with a specific standard deviation σε.
For the simulation of the random walk with a drift (rw1), we need to estimate the values of
y0, the first value of the series, which is the log S&P500 index of the first day
ϕ0
σε
We have to estimate ϕ0 using the last and the first real values of the series following the equation of the random walk.
Let’s calculate the first values of Y according to the random walk equation. We have to start with an initial value today (period t=0):
\[Y_{0}=Initialvalue\] Now, for tomorrow (t=1), and the next day (t=2), we apply the random walk equation. Then for t=1:
\[Y_{1}=\phi _{0}+Y_{0}+\varepsilon _{1}\] For t=2: \[Y_{2}=\phi _{0}+Y_{1}+\varepsilon _{2}\] Substituting Y1 in the Y2 equation:
\[Y_{2}=\phi _{0}+\phi _{0}+Y_{0}+\varepsilon _{1}+\varepsilon _{2}\] Re-arranging the terms:
\[Y_{2}=2*\phi _{0}+Y_{0}+\varepsilon _{1}+\varepsilon _{2}\] If we continue doing the same until the last day N, we get:
\[Y_{N}=N*\phi _{0}+Y_{0}+\sum_{t=1}^{N}\varepsilon _{t}\] This mathematical result is kind of intuitive. The value of a random walk at any day N will be equal to its initial value plus N times phi0 plus the sum of ALL random shocks from day 1 to day N.
The mean of all daily shocks is expected to be zero, so some days we will have negative shocks due to good news, and some days we will have positive shocks due to bad news.
Since the mean of the shocks is assumed to be zero, then also the expected value of the sum of the all shocks must be zero. Then:
\[E\left [ \sum_{t=1}^{N} \varepsilon _{t}\right ]=0\] We simplify the expected value of the last day YN as:
\[E\left [ Y_{N} \right ]=N*\phi _{0}+Y_{0}\] Then, ϕ0 = (last value - first value) / # of days.
In R we can calculate ϕ0 as follows:
lastprice = as.numeric(lnsp$lnsp[N])
# lnsp$lnsp[N] refers to the last row N of the vector lnsp$lnsp
firstprice = as.numeric(lnsp$lnsp[1])
# lnsp$lnsp[1] refers to the row 1 of the vector lnsp$lnsp
phi0<- (lastprice - firstprice) / N
cat("The value for phi0 is ",phi0)
## The value for phi0 is 0.000481682
Remember that N is the total # of days in the dataset, so lnsp[N] has the last daily value of the log of the S&P500.
To create the simulated random shocks for all days, we need to estimate sigma, which is the standard deviation of the shocks.
We can start estimating its variance first. It is known that the variance of a random walk cannot be determined unless we consider a specific number of periods.
Then, let’s consider the equation of the random walk series for the last value (YN), and then estimate its variance from there:
\[Y_{N}=N*\phi _{0}+Y_{0}+\sum_{t=1}^{N}\varepsilon _{t}\] Now we analyze the variance of the shock:
It is supposed that the variance is homogeneous over time. In other words, the standard deviation of the shocks is about the same over time, then:
\[Var(\varepsilon_{1})=Var(\varepsilon _{2})=Var(\varepsilon _{N})=\sigma _{\varepsilon }^{2}\] Then the sum of the variances of all shocks is actually the variance of the shock times N. Then the variance of all the shocks times N is actually the variance of YN.
Finally we express the volatility of the shock (σε) in terms of the volatility of YN (σY):
\[\sigma _{\varepsilon }=\frac{\sigma _{Y}}{\sqrt{N}}\] Then we can estimate sigma as: sigma = StDev(lnsp) / sqrt(N). Let’s do it in R:
sigma<-sd(lnsp$lnsp) / sqrt(N)
cat("The standard deviation of the log is = ",sd(lnsp$lnsp),"\n")
## The standard deviation of the log is = 0.398155
cat("The standard deviation (volatility) for the shock is = ",sigma)
## The standard deviation (volatility) for the shock is = 0.007136128
Simulating the random walk with drift
For each day, we create a random shock using the function rnorm. We create this shock with standard deviation equal to the volatility of the shock we calculated above (the sigma). We indicate that the mean =0:
shock <- rnorm(n=N,mean=0,sd=sigma)
lnsp$shock<-shock
We can see the shock over time:
plot(shock, type="l", col="blue")
We can also see whether the shock behaves like a normal distribution by doing its histogram:
hist(lnsp$shock)
As expected, the shock behaves similar to a normal-distributed variable.
Now we are ready to start the simulation of random walk.
Remember that we can express a random walk as its initial value plus N times the drift (ϕ0) plus the sum of all random shocks from the first day up a specific period N:
\[Y_{N}=N*\phi _{0}+Y_{0}+\sum_{t=1}^{N}\varepsilon _{t}\] Now we rename YN as rw1.
We can calculate the values for this random walk process in R as follows:
# I create a column for the day #:
lnsp$day = seq(1,N)
# The seq function returns consequtive numbers from 1 to N
lnsp$rw1 = firstprice + lnsp$day*phi0 + cumsum(lnsp$shock)
The cumsum function gets the cumulative sum of a variable from the first value up the each of the values of the variable.
I plot the simulated random walk and the real log of the S&P500:
ts.plot(lnsp$lnsp)
lines(seq(1,N),lnsp$rw1, col="blue")
Simulating a random walk with no drift
Now we can do a simulation but now without the drift. I this case, the ϕ0 coefficient must be zero.
We will use rw2 for this series. You can follow the logic we did for rw1, but now ϕ0 will be equal to zero, so we do not include it into the equation:
lnsp$rw2 = firstprice + cumsum(lnsp$shock)
I plot this random walk and the log of the S&P in one plot:
ts.plot(lnsp$lnsp)
# I plot both lines to compare
lines(x=seq(1,N),y=lnsp$rw2, col="green")
WHAT DO YOU OBSERVE WITH THIS PLOT? EXPLAIN WITH YOUR WORDS.
EN EL PRIMER GRÁFICO, EL MODELO DE RANDOM WALK 1 (rw1) NOS ARROJA UNA CORRELACIÓN POSITIVA AL ÍNDICE DEL S&P500; COMO PODEMOS VER, LA TENDENCIA ALCISTA ESTA PRESENTE TANTO EN EL ÍNDICE COMO EN EL MODELO (RANDOM WALK WITH DRIFT). POR OTRA PARTE, PARA LA SEGUNDA GRÁFICA, DONDE SE ELIMINÓ EL VALOR CONSTANTE (=0), PODEMOS VER QUE LA CORRELACIÓN HA SIDO INVERSA, Y SI BIEN, EL MODELO (rw2) NO MANTIENE UNA TENDENCIA BAJISTA COMO TAL, SI SE ALEJA BASTANTE DE LOS RETORNOS ESPERADOS DEL ÍNDICE (RANDOM WALK WITHOUT DRIFT).
Visualizing the log of the S&P and the rw1 again:
# I plot the natural log pf S&P500
ts.plot(lnsp$lnsp)
lines(seq(1,N),lnsp$rw1, col="blue")
RESPOND TO THE FOLLOWING QUESTIONS:
AFTER COMPARING THE SIMULATED RANDOM WALK WITH THE S&P500, DOES THE LOG OF THE S&P500 LOOKS LIKE A RANDOM WALK? WHY YES OR WHY NOT?
DE ACUERDO CON ECONOMIPEDIA, LA TEORÍA DEL PASEO ALEATORIO AFIRMA QUE TODO CAMBIO, O EVOLUCIÓN EXISTENTE EN LOS MERCADOS FINANCIEROS, NO ES MEDIBLE Y ESTIMABLE. ELLO SE DEBE A LA ALEATORIEDAD Y EFICIENCIA DE LOS MISMOS. A SU VEZ, SEÑALA QUE NO ES POSIBLE REALIZAR PREDICCIONES FIABLES DEL PRECIO DE LOS ACTIVOS ESTUDIANDO ÚNICAMENTE SU EVOLUCIÓN PASADA. CON BASE EN ELLO, PODEMOS INFERIR QUE SIN DUDA ALGUNA LOS RETORNOS CONTINUOS COMPUESTOS DEL ÍNDICE LUCEN PARECIDO A LO QUE POSTULA LA TEORÍA DEL PASEO ALEATORIO; DONDE CLARAMENTE A PESAR DE TENER UNA TENDENCIA ALCISTA, LA ALEAORIEDAD DE LOS FACTORES MACROECONOMICOS PUEDEN HACER CRECER, RETROCEDER O CONSOLIDAR LOS MERCADOS EN CUALQUIER MOMENTO.
DO YOU THINK THAT WE CAN USE THIS TYPE OF SIMULATION TO PREDICT STOCK PRICES OR INDEXES? WHY YES OR WHY NOT?
SIN DUDA ALGUNA. SI BIEN, EL MODELO SUPONE QUE EL ESTUDIO HISTÓRICO DE LOS PRECIOS NO GARANTIZA MAYORES GANANCIAS FUTURAS; PIENSO QUE REALMENTE ES UN MODELO FIABLE PARA COMPLEMENTAR NUESTROS ANÁLISIS DE INVERSIÓN, YA QUE ASÍ COMO EL MERCADO PUEDE CRECER, EN CUALQUIER MOMENTO PUEDE RETROCEDER DADO LA MISMA ALEATORIEDAD DE CUALQUIER FACTOR INCOGNOSCIBLE PARA EL ANALISTA. AUNADO A ELLO, CONSIDERO QUE ALINEADO AL MODELO, LA MEJOR GESTIÓN SIEMPRE VA A SER PASIVA, A LARGO PLAZO Y BUSCANDO REPLICAR EL COMPORTAMIENTO DEL MERCADO EN GENERAL, EN ESTE CASO, PODRÍAMOS USAR EL SPY ETF, POR EJEMPLO.
Q Reading
Read/skim the note: “Introduction to time series”. With your own words:
EXPLAIN WHAT IS A STATIONARY SERIES.
DE ACUERDO CON LA LECTURA “INTRODUCTION TO TIME SERIES”, UNA SERIE DE TIEMPO ES ESTACIONARIA CUANDO SU DISTRIBUCIÓN Y SUS PARÁMETROS NO VARÍAN CON EL PASO DEL TIEMPO. EN OTRAS PALABRAS, CUANDO LA MEDIA Y LA VARIANZA DE UNA DETERMINADA SERIE DE TIEMPO NO CAMBIAN CON EL TIEMPO, Y TAMPOCO HAY ALGUNA TENDENCIA PRESENTE.
WHICH ARE THE CONDITIONS OF A SERIES TO BE CONSIDERED AS A STATIONARY SERIES?
· EL PROMEDIO O EL VALOR ESPERADO DE LA SERIE ES CONSTANTE A TRAVES DEL TIEMPO. · LA VARIANZA Y LA DESVIACIÓN ESTÁNDAR DE LA SERIE ES APROXIMADAMENTE LA MISMA A TRAVÉS DEL TIEMPO. · LA AUTOCOVARIANZA Y LA AUTOCORRELACIÓN DEL ACTIVO EN CUESTIÓN ES LA MISMA PARA CUALQUIER PERIODO DE TIEMPO.