Now you have to simulate 2 ARCH(1) models using 500 periods (days) with the following specifications:
For model 1 use β0=0, α0=1, and α1=0.90 You can do this simulation in R as follows: W
# Set all the working directory
setwd("~/Desktop/Financial Econometrics II ")
# What happen if?
alpha0=1
alpha1= 0.9
B0= 0
I create empty vectors for the 500 variances and shocks:
# I will simulate 2- years of a financial instrument with mean =0
n = 500
error = single(n)
h = single(n)
The single function creates a numeric vector with zero values.
I generate the first random shock following the specifications:
# The teacher define the values for variance and shock for day 1:
h[1] = alpha0 + alpha1*0
# Since there is no shock at day 0, I will assign 0 to this shock, so I only
# consider alpha for the formula of the variance
error[1] = rnorm(n = 1, mean=0, sd=sqrt(h[1]))
Now create the Y variable, which will be an ARCH(1) process. Assign the value for Y for the first day:
# Now I fill out the values for day 2 up to day 500:
Y= single(length=n)
Y[1]= B0 + error[1]
Now fill out the Y values for the rest of the days
for (i in 2:n){
h[i] <- alpha0 + alpha1*((error[i-1]^2))
error[i] <- rnorm(n=1, 0, sqrt(h[i]))
}
We can see the first values of the h and the error:
head(error)
## [1] -1.1287250 -0.6911466 -0.9123494 0.1734740 0.3539584 -0.4611362
head(h)
## [1] 1.000000 2.146618 1.429915 1.749143 1.027084 1.112758
Now I create the Y values from day 2 to day 500:
for (i in 2:n){
Y[i] <- B0 + error[i]
}
plot(Y, type="l", col="blue")
Now using the same dataset SIMULATE model 2 (as Y2) as another ARCH(1). Use alpha0 = 0.1 and alpha1=0.1
alpha0_2 = 0.1
alpha1_2 = 0.1
B0_2 = 0
n_2 = 500
error_2 <- single(n_2)
h_2 <- single(n_2)
h_2[1] = alpha0_2 + alpha1_2*0
error_2[1] = rnorm(n = 1, mean = 0, sd=sqrt(h[1]))
Y2 = single(length=n_2)
Y2[1] = B0_2 + error_2[1]
for (i in 2:n_2){
h_2[i] <- alpha0_2 + alpha1_2*((error_2[i-1]^2))
error_2[i] <- rnorm(n=1, 0, sqrt(h_2[i]))
}
for (i in 2:n_2){
Y2[i] <- B0_2 + error_2[i]
}
plot(Y2, type="l", col="green")
Plot Y2 compare with Y
WHAT IS THE DIFFERENCE BETWEEN THE SERIES Y AND Y2? WHAT I CAN SEE IS THAT THE MAGNITUDE OF THE VOLATILITY IS LESS IN THE MODEL Y2 THAN THE MODEL Y, SO I CAN SAY THAT IF THE ALPHA0 AND ALPHA1 ARE SMALL NUMBERS OR < THAN 1 THE VOLATILITY OF THE ERROS WILL BEE SMALL WITH A HOMOSCEDASTICITY. Looking at the original ARCH equation, EXPLAIN why do you think both series are different? I AM GOING TO SAY THAT BECAUSE OF THE MAFNITUDE OF THE ALPHAS, SO THE RANDOM SHOCKS THAT ARE NOT TOO BIG COMPERING WITH THE PAST ARE HOMOSCEDASTIC AND THE RANDOM SHOCKS THAT ARE BIG ARE HETEROSCEDASTICITY.
In this exercise we analyze volatility of financial returns using rolling windows. It has been shown that volatility of financial instruments changeS over time. As we practiced in previous exercise, family ARCH models are designed to model the changing volatility, which is the standard deviation of returns (actually, these models analyze the changing variance, but the volatility is the squared root of the variance). In this part, we will use daily returns of a market index, and calculate rolling means and rolling standard deviations using a moving/rolling windows of 20 business days.
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
Get the data from Yahoo Finance
IPC <- getSymbols("^MXX", from="2008-01-01",auto.assign = FALSE)[,6]
## '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.
## Warning: ^MXX contains missing values. Some functions will not work if objects
## contain missing values in the middle of the series. Consider using na.omit(),
## na.approx(), na.fill(), etc to remove or replace them.
# auto.assign=FALSE since I want the dataset to be called IPC, not MXX
# I indicate to get the column 6 of the dataset, which is the adjusted price
Then I calculate cc returns of the IPCyC index
ipc_ret <- na.omit(diff(log(IPC)))
2.Using the rollapply() function from the zoo package, and a moving window of 20 business days (one month), generate a dataset with the rolling mean and rolling volatility of the IPyC continuously compounded returns:
library(zoo)
roll_mean <- na.omit(rollapply(ipc_ret, 20, mean))
roll_sd <- na.omit(rollapply(ipc_ret, 20, sd))
ipc_mean_vol <- merge(roll_mean, roll_sd)
colnames(ipc_mean_vol) <- c("roll_mean", "roll_sd")
plot(ipc_mean_vol)
WHAT DO YOU OBSERVE? In which periods you observe more volatility? Describe with your words, if you see a relationship between volatility and average returns.
I OBSERVE THAT THE VOLATILITY OF THE IPyC IN CHANGING PERIODS OF TIME IS HETEROSCEDASTICITY AND THERE IS SOME PARTS IN WHERE THE VOLATILITY RADICALLY INCREASES IN DATES WHERE FINANCIAL CRISES OCCURRED. IN ADDITION TO THIS IT SEEMS THAT THE VOLATILITY AND THE MEAN DAILY STOCK RETURAS ARE NEGATIVELY RELATED.
THE VOLATILITY OF THE RETURNS FROM THE IPyC IS STRONGLLY CORRELATED WITH THE RETURNS BECAUSE THE INVESTORS DONT WANT TO INVEST IN A STOCKS WHERE THE PRICE CAN RADICALLY CHANGE IN THE TIME. WHEN THE FINANCIAL CRISIS OCCURED THE VOLATILITY RISE HUGE LEVES AND THE RETURNS GOT A HISTORIC MINIMUN PRICE.
roll_mean <- na.omit(rollapply(ipc_ret, 5, mean))
roll_sd <- na.omit(rollapply(ipc_ret, 5, sd))
ipc_mean_vol <- merge(roll_mean, roll_sd)
colnames(ipc_mean_vol) <- c("roll_mean", "roll_sd")
plot(ipc_mean_vol)
Report your responses to the same questions and compare the results with the 20-day window results.
NOW THE VOLATILITY OF 5 DAYS IS BIGGER THAN THE VOLATILITY OF 20 DAYS AND THE RETURNS ALSO DECREASE EXPONENTIALY COMPERD WITH THE LAST MODEL.
IPC13 <- getSymbols("^MXX", from="2013-01-01",auto.assign = FALSE)[,6]
## Warning: ^MXX contains missing values. Some functions will not work if objects
## contain missing values in the middle of the series. Consider using na.omit(),
## na.approx(), na.fill(), etc to remove or replace them.
# I calculate cc returns:
ipc_ret13 <- na.omit(diff(log(IPC13)))
colnames(ipc_ret13) <- c("r")
Now we check whether the IPCyC returns are heteroscedastic. You can do this by testing whether the cc IPCyC returns follows an ARCH process. Do this test and interpret it.
We do this test with the ArchTest function from the FinTS package. Install this package first:
#install.packages("FinTS")
library(FinTS)
ArchTest(ipc_ret13$r)
##
## ARCH LM-test; Null hypothesis: no ARCH effects
##
## data: ipc_ret13$r
## Chi-squared = 436.68, df = 12, p-value < 2.2e-16
INTERPRETATION:
Since the p-value of this test is less than 0.05, we can reject the NULL hypothesis that states that there is NO ARCH effects. In sum, we can have statistical evidence to say that the IPCyC returns has heteroscedasticity in its variance.
library(fGarch)
## Loading required package: timeDate
## Loading required package: timeSeries
##
## Attaching package: 'timeSeries'
## The following object is masked from 'package:zoo':
##
## time<-
## Loading required package: fBasics
##
## Attaching package: 'fBasics'
## The following object is masked from 'package:TTR':
##
## volatility
arch.fit <- garchFit(~garch(1,0), data = ipc_ret13$r, trace = F)
## Warning: Using formula(x) is deprecated when x is a character vector of length > 1.
## Consider formula(paste(x, collapse = " ")) instead.
summary(arch.fit)
##
## Title:
## GARCH Modelling
##
## Call:
## garchFit(formula = ~garch(1, 0), data = ipc_ret13$r, trace = F)
##
## Mean and Variance Equation:
## data ~ garch(1, 0)
## <environment: 0x7f84cc5e05c8>
## [data = ipc_ret13$r]
##
## Conditional Distribution:
## norm
##
## Coefficient(s):
## mu omega alpha1
## 3.1951e-05 6.7804e-05 3.1777e-01
##
## Std. Errors:
## based on Hessian
##
## Error Analysis:
## Estimate Std. Error t value Pr(>|t|)
## mu 3.195e-05 1.982e-04 0.161 0.872
## omega 6.780e-05 2.896e-06 23.411 < 2e-16 ***
## alpha1 3.178e-01 3.937e-02 8.071 6.66e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Log Likelihood:
## 6741.167 normalized: 3.244065
##
## Description:
## Wed Apr 21 17:26:44 2021 by user:
##
##
## Standardised Residuals Tests:
## Statistic p-Value
## Jarque-Bera Test R Chi^2 559.2995 0
## Shapiro-Wilk Test R W 0.9770408 0
## Ljung-Box Test R Q(10) 27.6875 0.002025245
## Ljung-Box Test R Q(15) 31.63487 0.007216246
## Ljung-Box Test R Q(20) 40.98469 0.003742133
## Ljung-Box Test R^2 Q(10) 228.8158 0
## Ljung-Box Test R^2 Q(15) 364.8103 0
## Ljung-Box Test R^2 Q(20) 418.3217 0
## LM Arch Test R TR^2 193.948 0
##
## Information Criterion Statistics:
## AIC BIC SIC HQIC
## -6.485243 -6.477102 -6.485247 -6.482259
We can also run the same ARCH model using the ugarchfit from the rugarch package.
# Load the librarys
library(FinTS)
library(rugarch)
## Loading required package: parallel
##
## Attaching package: 'rugarch'
## The following object is masked from 'package:stats':
##
## sigma
#ARCH(1)
Espec1=ugarchspec(variance.model= list(model= "sGARCH", garchOrder= c(1, 0),
submodel= NULL, external.regressors= NULL, variance.targeting= FALSE),
mean.model= list(armaOrder= c(0, 0), include.mean= TRUE, archm= FALSE,
archpow= 0, arfima= FALSE, external.regressors= NULL, archex= FALSE),
distribution.model= "norm", start.pars= list(), fixed.pars= list())
#Running the ARCH model with the specifications:
garch1<- ugarchfit(spec=Espec1, data=ipc_ret13$r)
garch1
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : sGARCH(1,0)
## Mean Model : ARFIMA(0,0,0)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 0.002402 0.000001 2482.6198 0.000000
## omega 0.000000 0.000000 1.9666 0.049234
## alpha1 0.766827 0.004201 182.5214 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.002402 0.000134 17.930900 0.00000
## omega 0.000000 0.000045 0.003036 0.99758
## alpha1 0.766827 1.932542 0.396797 0.69152
##
## LogLikelihood : -14235.38
##
## Information Criteria
## ------------------------------------
##
## Akaike 13.704
## Bayes 13.712
## Shibata 13.704
## Hannan-Quinn 13.707
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.4046 0.5247
## Lag[2*(p+q)+(p+q)-1][2] 0.6334 0.6342
## Lag[4*(p+q)+(p+q)-1][5] 2.9733 0.4119
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 1.780 0.1822
## Lag[2*(p+q)+(p+q)-1][2] 1.787 0.3007
## Lag[4*(p+q)+(p+q)-1][5] 1.926 0.6361
## d.o.f=1
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[2] 0.01509 0.500 2.000 0.9022
## ARCH Lag[4] 0.12900 1.397 1.611 0.9773
## ARCH Lag[6] 0.26656 2.222 1.500 0.9923
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 46.4642
## Individual Statistics:
## mu 0.1799
## omega 35.9517
## alpha1 40.3137
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 0.846 1.01 1.35
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 3.148 1.670e-03 ***
## Negative Sign Bias 4.534 6.108e-06 ***
## Positive Sign Bias 6.309 3.424e-10 ***
## Joint Effect 65.659 3.626e-14 ***
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 2155 0
## 2 30 3132 0
## 3 40 4118 0
## 4 50 4923 0
##
##
## Elapsed time : 0.2890339
Both functions get the same estimations for the ARCH coefficients.
INTERPRET THE OUTPUT OF THE ARCH(1) model. You have to interpret the omega, alpha and mu coefficients. The omega coefficient is equivalent to the alpha0 coefficient of our model, and the mu coefficient is our beta0 coefficient.
THE MU(BETA0) IS THE MEAN OVER TIME WICH IN THIS MODEL IS VERY CLOSE TO 0, AND IT IS NOT SIGNIFICANT. THE OMEGA(alpha0) IS ALSO THE CONSTANT ANS IS STADISTICALLY SIGNIFICANT. AND FOR THE alpha1 31.85% OF THE TIME THE SQUARE RANDOM SHOCKS OF YESTERDAY ARE PASSED TO IMPACT THE VARIANCE OF TODAY, ALSO THIS EFFECT IS POSITIVE AND STADISTICALLY SIGNIFICAT. THIS MEANS THAT THE ERROS OR RANDOM SHOCK OF YESTERDAY INDEED ARE AFFECTING IN ABOUT 31.85% THE VARIANCE OF TODAYS RANDOM SHOCKS.
IF WE PLOT THE VARIABLE WE CAN SEE THE HETEROSCEDASTICITY
plot(ipc_ret13$r)
3. Check if a GARCH(1,1) fits the series. Run the model :
garch.fit <- garchFit(~garch(1,1), data = ipc_ret13$r, trace = F)
## Warning: Using formula(x) is deprecated when x is a character vector of length > 1.
## Consider formula(paste(x, collapse = " ")) instead.
summary(garch.fit)
##
## Title:
## GARCH Modelling
##
## Call:
## garchFit(formula = ~garch(1, 1), data = ipc_ret13$r, trace = F)
##
## Mean and Variance Equation:
## data ~ garch(1, 1)
## <environment: 0x7f84bcafbdc8>
## [data = ipc_ret13$r]
##
## Conditional Distribution:
## norm
##
## Coefficient(s):
## mu omega alpha1 beta1
## 1.5331e-04 2.9876e-06 1.0949e-01 8.6022e-01
##
## Std. Errors:
## based on Hessian
##
## Error Analysis:
## Estimate Std. Error t value Pr(>|t|)
## mu 1.533e-04 1.755e-04 0.874 0.382297
## omega 2.988e-06 8.076e-07 3.699 0.000216 ***
## alpha1 1.095e-01 1.569e-02 6.980 2.95e-12 ***
## beta1 8.602e-01 2.026e-02 42.463 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Log Likelihood:
## 6869.425 normalized: 3.305787
##
## Description:
## Wed Apr 21 17:26:46 2021 by user:
##
##
## Standardised Residuals Tests:
## Statistic p-Value
## Jarque-Bera Test R Chi^2 89.17643 0
## Shapiro-Wilk Test R W 0.9914578 1.067385e-09
## Ljung-Box Test R Q(10) 23.27568 0.0097735
## Ljung-Box Test R Q(15) 26.24833 0.03549212
## Ljung-Box Test R Q(20) 35.12304 0.01945869
## Ljung-Box Test R^2 Q(10) 24.20073 0.007085054
## Ljung-Box Test R^2 Q(15) 27.16421 0.0274266
## Ljung-Box Test R^2 Q(20) 32.0035 0.04326108
## LM Arch Test R TR^2 25.49842 0.0126298
##
## Information Criterion Statistics:
## AIC BIC SIC HQIC
## -6.607724 -6.596869 -6.607732 -6.603746
We can also run the same model using the other function:
#ARCH(1)
Espec2=ugarchspec(variance.model= list(model= "sGARCH", garchOrder= c(1, 1),
submodel= NULL, external.regressors= NULL, variance.targeting= FALSE),
mean.model= list(armaOrder= c(0, 0), include.mean= TRUE, archm= FALSE,
archpow= 0, arfima= FALSE, external.regressors= NULL, archex= FALSE),
distribution.model= "norm", start.pars= list(), fixed.pars= list())
#Estimación del GARCH(1,1)
garch1<- ugarchfit(spec=Espec2, data=ipc_ret13$r)
garch1
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : sGARCH(1,1)
## Mean Model : ARFIMA(0,0,0)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 0.000152 0.000176 0.86322 0.38802
## omega 0.000003 0.000002 1.67635 0.09367
## alpha1 0.109813 0.014748 7.44619 0.00000
## beta1 0.860266 0.019563 43.97517 0.00000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.000152 0.000161 0.94299 0.345685
## omega 0.000003 0.000008 0.35261 0.724383
## alpha1 0.109813 0.028170 3.89821 0.000097
## beta1 0.860266 0.070966 12.12223 0.000000
##
## LogLikelihood : 6869.427
##
## Information Criteria
## ------------------------------------
##
## Akaike -6.6077
## Bayes -6.5969
## Shibata -6.6077
## Hannan-Quinn -6.6037
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 10.29 0.001341
## Lag[2*(p+q)+(p+q)-1][2] 10.50 0.001406
## Lag[4*(p+q)+(p+q)-1][5] 13.56 0.001081
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.06767 0.79476
## Lag[2*(p+q)+(p+q)-1][5] 3.34337 0.34791
## Lag[4*(p+q)+(p+q)-1][9] 9.14138 0.07602
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 3.828 0.500 2.000 0.05039
## ARCH Lag[5] 6.024 1.440 1.667 0.05929
## ARCH Lag[7] 10.775 2.315 1.543 0.01213
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 9.4039
## Individual Statistics:
## mu 0.04285
## omega 2.04850
## alpha1 0.26414
## beta1 0.22259
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.07 1.24 1.6
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 0.3735 0.7088
## Negative Sign Bias 1.1061 0.2688
## Positive Sign Bias 0.7364 0.4616
## Joint Effect 2.4229 0.4894
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 40.61 2.716e-03
## 2 30 55.87 1.959e-03
## 3 40 82.69 5.611e-05
## 4 50 96.59 5.919e-05
##
##
## Elapsed time : 0.168561
INTERPRET the model output
predict(garch.fit, n.ahead=5, plot=TRUE)
## meanForecast meanError standardDeviation lowerInterval upperInterval
## 1 0.0001533093 0.009840475 0.009840475 -0.01913367 0.01944029
## 2 0.0001533093 0.009843217 0.009843217 -0.01913904 0.01944566
## 3 0.0001533093 0.009845876 0.009845876 -0.01914425 0.01945087
## 4 0.0001533093 0.009848453 0.009848453 -0.01914930 0.01945592
## 5 0.0001533093 0.009850951 0.009850951 -0.01915420 0.01946082
Download the daily returns of CEMEX and the IPCyC (from Jan 2015 to date) from Yahoo finance. Save the variable as datacemex.
getSymbols("CEMEXCPO.MX", periodicity= "daily",from = "2015-01-01")
## [1] "CEMEXCPO.MX"
getSymbols("^MXX", periodicity= "daily",from = "2015-01-01")
## [1] "^MXX"
datacemex <- merge(CEMEXCPO.MX$CEMEXCPO.MX.Adjusted, MXX$MXX.Adjusted)
Run a simple market model to estimate a beta coefficient of CEMEX. As comments, adequately interpret the beta coefficient, the Jensen alpha coefficient, and their p-values First I am going to calculate the cc returns
datacemex$stockreturns <- log(datacemex$CEMEXCPO.MX.Adjusted /(lag(datacemex$CEMEXCPO.MX.Adjusted,1)))
datacemex$ipc_returns <- diff(log(datacemex$MXX.Adjusted))
datacemex$stockreturs2 <- diff(log(datacemex$CEMEXCPO.MX.Adjusted))
m1 <- lm(datacemex$stockreturns ~ datacemex$ipc_returns)
summary(m1)
##
## Call:
## lm(formula = datacemex$stockreturns ~ datacemex$ipc_returns)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.089846 -0.010205 -0.000752 0.009079 0.112411
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -3.933e-05 4.744e-04 -0.083 0.934
## datacemex$ipc_returns 1.463e+00 4.689e-02 31.209 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.01886 on 1578 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.3817, Adjusted R-squared: 0.3813
## F-statistic: 974 on 1 and 1578 DF, p-value: < 2.2e-16
THE DEPENDANT VARIBALE OF THIS MODEL IS THE DAILY STOCK RETURN OF CEMX AND THE INDEPENDENT VARIABLE IS THE MEXICAN MARKET. THERE IS STATISTICAL EVIDENCE TO SAY THAT THE MARKET RETURNS ARE POSITIVELY RELATED TO CEMEX DAILY STOCK RETURN WHICH MEANS THAT EVERY TIME THE IPCyC RETURNS MOVE IN 1%, CEMEX RETURNS WILL MOVE IN ABOUT 1.463%
The OLS regression method you used in the previous point is adequate when we assume no autocorrelation of errors and also homogeneity of variance is assumed for any OLS regresson model. If these assumptions do not hold then the OLS coefficients might be accurate but its standard error will not be reliable. You have to examine the data to check for both autocorrelation and heterogeneity of variance. Do the following:
Check evidence for homogeneity of error variance in the market model. Do the corresponding test and interpret it. (test whether the residuals of the regression follows an ARCH process)
datacemex$residuals <- m1$residuals
ArchTest(datacemex$residuals)
##
## ARCH LM-test; Null hypothesis: no ARCH effects
##
## data: datacemex$residuals
## Chi-squared = 97.125, df = 12, p-value = 2.033e-15
INTERPRETATION
SINCE THE P-VALUE OF THIS TEST IS LESS THAN 0.05, WE CAN REJECT THE NULL HYPOTHESIS THAT STATES THAT THERE IS NO ARCH EFFECTS. IN ADDITION TO THIS WE HAVE ENOUGHT STATISTICAL EVIDENCE TO SAY THAT THE MODEL OF MARKET RITURNS OVER A STOCK HAST HETERISCEDASTICITY.
#ARCH(5)
datacemex <- na.omit(datacemex)
Espec3=ugarchspec(variance.model= list(model= "sGARCH", garchOrder= c(5, 0),
submodel= NULL, external.regressors= NULL, variance.targeting= FALSE),
mean.model= list(armaOrder= c(0, 0), include.mean= TRUE, archm= FALSE,
archpow= 0, arfima= FALSE, external.regressors= datacemex$ipc_returns, archex= FALSE),
distribution.model= "norm", start.pars= list(), fixed.pars= list())
#Estimación del GARCH(1,1)
garch1<- ugarchfit(spec=Espec3, data=datacemex$stockreturns)
garch1
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : sGARCH(5,0)
## Mean Model : ARFIMA(0,0,0)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu -0.000409 0.000428 -0.9555 0.339327
## mxreg1 1.462070 0.048540 30.1211 0.000000
## omega 0.000205 0.000016 12.9461 0.000000
## alpha1 0.164256 0.033284 4.9349 0.000001
## alpha2 0.108441 0.032666 3.3197 0.000901
## alpha3 0.104474 0.037652 2.7748 0.005524
## alpha4 0.044838 0.026786 1.6739 0.094150
## alpha5 0.026951 0.025620 1.0520 0.292815
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu -0.000409 0.000451 -0.90573 0.365078
## mxreg1 1.462070 0.060211 24.28245 0.000000
## omega 0.000205 0.000031 6.65198 0.000000
## alpha1 0.164256 0.045237 3.63099 0.000282
## alpha2 0.108441 0.047271 2.29402 0.021790
## alpha3 0.104474 0.054024 1.93385 0.053131
## alpha4 0.044838 0.038384 1.16812 0.242760
## alpha5 0.026951 0.042496 0.63421 0.525943
##
## LogLikelihood : 4094.245
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.1757
## Bayes -5.1486
## Shibata -5.1758
## Hannan-Quinn -5.1656
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.03268 0.8565
## Lag[2*(p+q)+(p+q)-1][2] 0.88787 0.5361
## Lag[4*(p+q)+(p+q)-1][5] 1.83363 0.6582
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.1474 0.701070
## Lag[2*(p+q)+(p+q)-1][14] 13.7995 0.042995
## Lag[4*(p+q)+(p+q)-1][24] 26.5633 0.003326
## d.o.f=5
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[6] 0.1435 0.500 2.000 0.7048013
## ARCH Lag[8] 0.1769 1.480 1.774 0.9762807
## ARCH Lag[10] 18.8050 2.424 1.650 0.0003215
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 3.3858
## Individual Statistics:
## mu 0.09339
## mxreg1 0.22667
## omega 1.30635
## alpha1 0.22777
## alpha2 0.76740
## alpha3 0.26510
## alpha4 0.89586
## alpha5 1.31427
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.89 2.11 2.59
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 0.75536 0.4501
## Negative Sign Bias 0.01543 0.9877
## Positive Sign Bias 0.56425 0.5727
## Joint Effect 0.80212 0.8490
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 89.23 4.535e-11
## 2 30 105.58 1.229e-10
## 3 40 115.46 1.712e-09
## 4 50 130.15 2.768e-09
##
##
## Elapsed time : 0.6359019
#ARCH(1)
Espec4=ugarchspec(variance.model= list(model= "sGARCH", garchOrder= c(1, 1),
submodel= NULL, external.regressors= NULL, variance.targeting= FALSE),
mean.model= list(armaOrder= c(0, 0), include.mean= TRUE, archm= FALSE,
archpow= 0, arfima= FALSE, external.regressors= datacemex$ipc_returns, archex= FALSE),
distribution.model= "norm", start.pars= list(), fixed.pars= list())
#Estimación del GARCH(1,1)
garch1<- ugarchfit(spec=Espec4, data=datacemex$stockreturns)
garch1
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : sGARCH(1,1)
## Mean Model : ARFIMA(0,0,0)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu -0.000285 0.000416 -0.68449 0.493668
## mxreg1 1.449374 0.049479 29.29250 0.000000
## omega 0.000006 0.000002 3.79821 0.000146
## alpha1 0.051649 0.006153 8.39458 0.000000
## beta1 0.931153 0.007818 119.10891 0.000000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu -0.000285 0.000406 -0.70236 0.482454
## mxreg1 1.449374 0.069057 20.98811 0.000000
## omega 0.000006 0.000004 1.70978 0.087307
## alpha1 0.051649 0.008694 5.94039 0.000000
## beta1 0.931153 0.012221 76.19206 0.000000
##
## LogLikelihood : 4121.455
##
## Information Criteria
## ------------------------------------
##
## Akaike -5.2140
## Bayes -5.1970
## Shibata -5.2140
## Hannan-Quinn -5.2077
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.02347 0.8782
## Lag[2*(p+q)+(p+q)-1][2] 0.43851 0.7232
## Lag[4*(p+q)+(p+q)-1][5] 1.93938 0.6328
## d.o.f=0
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 6.225 0.01260
## Lag[2*(p+q)+(p+q)-1][5] 6.840 0.05671
## Lag[4*(p+q)+(p+q)-1][9] 9.238 0.07259
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 6.623e-05 0.500 2.000 0.9935
## ARCH Lag[5] 1.745e+00 1.440 1.667 0.5303
## ARCH Lag[7] 3.315e+00 2.315 1.543 0.4561
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 6.4475
## Individual Statistics:
## mu 0.08301
## mxreg1 0.42171
## omega 0.12139
## alpha1 0.28270
## beta1 0.41855
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.28 1.47 1.88
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 0.8807 0.37861
## Negative Sign Bias 1.7793 0.07538 *
## Positive Sign Bias 0.5232 0.60093
## Joint Effect 3.5277 0.31719
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 73.70 2.205e-08
## 2 30 84.00 2.969e-07
## 3 40 90.44 5.767e-06
## 4 50 100.70 1.951e-05
##
##
## Elapsed time : 0.1657081