Question

In: Computer Science

How to fit an example of non-stationary data into GARCH model in R programming.

How to fit an example of non-stationary data into GARCH model in R programming.

Solutions

Expert Solution

Answer) Dear student , we are taking example of Time Series Analysis( non-stationary) with GARCH model in R Programming

Differencing: In order to convert non-stationary series to stationary, differencing method can be used in which the series is lagged 1 step and subtracted from original series:

For example: Yt = Yt-1 +et   
  
et = Yt – Yt-1

In financial time series, it is often that the series is transformed by logging and then the differencing is performed. This is because financial time series is usually exposed to exponential growth, and thus log transformation can smooth out (linearize) the series and differencing will help stabilize the variance of the time series.

Following is an example of Apple stock price:

• The upper left graph is the original time series of Apple stock price from 01/01/2007 to 07/24/2012, showing exponential growth

• The lower left graph shows the differences of apple stock prices. It can be seen that the series is price-dependent; in other words, the variance of the series increases as the level of original series increases, and therefore, is not stationary

• The upper right corner show the graph of log price of Apple. The series is more linear compared to the original one.

• The lower right graphs the differences of log price of Apple. The series seems more meanreverting, and variance is constant and does not significantly change as level of original series changes

To perform the differencing in R, follow these steps:

• Read the data file in R and store it in a variable

appl=read.csv('Apple.csv')
appl.close=appl$Adjclose #read and store adj close price in original file

• Plot original stock price

plot(appl.close,type='l',main='Apple Stock Price')

• Differencing the original series

diff.appl=diff(appl.close)

• Plot differences of original series

plot(diff.appl,type='l',main='Difference Apple')

• Take log of original series and plot the log price

log.appl=log(appl.close)
plot(log.appl,type='l',main='Log Apple')

• Differencing log price and plot

difflog.appl=diff(log.appl) plot(difflog.appl,type='l',main='Difference Log Apple')



Another point that makes the differences of time series is more of interest than price series is that people often look at the returns of the stock rather than the its prices. Differences of log prices represent the returns and are similar to percentage changes of stock prices.


Related Solutions

Build a garch model using the following monthly change data for Mexico. Use R DATE INFLATION...
Build a garch model using the following monthly change data for Mexico. Use R DATE INFLATION ene-05 4.54 feb-05 4.27 mar-05 4.39 abr-05 4.6 may-05 4.6 jun-05 4.33 jul-05 4.47 ago-05 3.95 sep-05 3.51 oct-05 3.05 nov-05 2.91 dic-05 3.33 ene-06 3.94 feb-06 3.75 mar-06 3.41 abr-06 3.2 may-06 3 jun-06 3.18 jul-06 3.06 ago-06 3.47 sep-06 4.09 oct-06 4.29 nov-06 4.09 dic-06 4.05 ene-07 3.98 feb-07 4.11 mar-07 4.21 abr-07 3.99 may-07 3.95 jun-07 3.98 jul-07 4.14 ago-07 4.03...
What are the problems of analyzing non-stationary data?
What are the problems of analyzing non-stationary data?  
What is "fitting" in/of Hidden Markov Model, how to fit HMM for data??
What is "fitting" in/of Hidden Markov Model, how to fit HMM for data??
Plot the data and line of best fit in R and paste it into this document
C D 3 2 6 7 8 5 9 4 1 0 3 4 Plot the data and line of best fit in R and paste it into this document Code: Plot:
a. Using the following R codes to fit the linear regression model for VitC on HeadWt,...
a. Using the following R codes to fit the linear regression model for VitC on HeadWt, and obtain its summary. Paste the R output in your homework. cabbages_data <- read.csv("http://users.stat.umn.edu/~wuxxx725/data/cabbages_data.csv") cabbages_reg <- lm(VitC ~ HeadWt, data = cabbages_data) summary(cabbages_reg) b. State and interpret the value of r 2 from the model summary output in part a). c. Calculate the correlation r between HeadWt and VitC, and state the strength and the direction of the correlation. d. State the estimated regression...
Using the following R codes to fit the linear regression model for VitC on HeadWt, and...
Using the following R codes to fit the linear regression model for VitC on HeadWt, and obtain its summary. Paste the R output in your homework. cabbages_data <- read.csv("http://users.stat.umn.edu/~wuxxx725/data/cabbages_data.csv") cabbages_reg <- lm(VitC ~ HeadWt, data = cabbages_data) summary(cabbages_reg)
a. Using the following R codes to fit the linear regression model for VitC on HeadWt,...
a. Using the following R codes to fit the linear regression model for VitC on HeadWt, and obtain its summary. Paste the R output in your homework. cabbages_data <- read.csv("http://users.stat.umn.edu/~wuxxx725/data/cabbages_data.csv") cabbages_reg <- lm(VitC ~ HeadWt, data = cabbages_data) summary(cabbages_reg) b. State and interpret the value of r 2 from the model summary output in part a). c. Calculate the correlation r between HeadWt and VitC, and state the strength and the direction of the correlation. d. State the estimated regression...
The R library faraway contains the pima dataset. We will fit a model with test as...
The R library faraway contains the pima dataset. We will fit a model with test as a response and bmi (only) as a predictor to see the relationship between the odds of a patient showing signs of diabetes and his/her bmi. The odds o and probability p are related by: o = p/(1-p), p = o(1+o) Using the GLM function: a. Please estimate the amount of increase in the log(odds) when the bmi increases by 10. b. Give a 95%...
how do the constructs of the Health Belief Model and the Transtheoretical Model “fit” into the...
how do the constructs of the Health Belief Model and the Transtheoretical Model “fit” into the eight conditions that must be true for a person to perform that behavior?
Fit your best model to the following data. I would recommend studying the data and then...
Fit your best model to the following data. I would recommend studying the data and then trying to fit it. Y X1 X2 X3 X4 X5 12229.31 101.51 77.44 7.32 122.08 51.45 19218.63 109.89 99.24 7.83 119.57 54.4 2579.63 95.75 103.61 4.68 125.69 53.35 7780.87 112.54 128.57 6.78 118.16 56.02 2135.14 108 116.21 4.18 120.68 48.99 1719.99 114.41 112.48 3.09 123.92 58.45 4538.07 123.96 98.62 6.1 122.83 57.47 3243.55 96.29 96.24 5.33 121.36 43.93 6983.13 90.04 121.44 6.57 121.96 47.19...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT