Hi there, I have two questions (which might be related). I am trying to predict mean and variance of monthly stock excess return using dividend price ratio with a eGarch model.
Data format is the following
column 1 column 2 column 3
gross S&P return gross t-bill return lagged dividend price ratio
#data dimension is nrow=750 and ncolumns =3 and the "redp.dat" file is attached.
code is following
library(rugarch);
dat=read.csv('C:\\redp.dat',header=F);
logexr=log(dat$V1)-log(dat$V2); # log of gross excess return
as.matrix(logexr);
dp=log(dat$V3); #log of dividend price ratio
as.matrix(dp);
spec = ugarchspec(variance.model = list(model = "eGARCH", garchOrder = c(1,1),
external.regressors = as.matrix(dp)),
mean.model = list(armaOrder=c(0,0), include.mean = T, external.regressors =
as.matrix(dp)), distribution.model = "norm");
# dividend price ratio are used as external regressor in both mean and variance
equation
test=ugarchroll(spec, n.ahead=1, data=logexr, forecast.length=400,
refit.every=1, refit.window="moving");
as.data.frame(test, which='LLH')
# where I did a rolling window forecast and display all the likelyhood
#then I did a double check on the rolling estimation by doing
for (j in 1:10) # I am justing printing the first ten loop step
myfit = ugarchfit(spec, logexr[j:349+j]);
likelihood(myfit)
end
# Question 1: the first likelihood from ugarchfit exactly equals that in
ugarchroll, while the values are different from then on.
# When I modify the spec to exclude any external regressor, the two sets of
likelihood are then exactly the same.
# reducing the forecast length (and therefore increase the length of the
estimation window) seems to mitigate the estimation difference.
# Question 2: I then compare the density forecast
as.data.frame(test, which='density')
# this seem to produce
for (j in 1:10) # I am justing printing the first ten loop step
ugarchforecast(myfit, n.ahead=1); # and again when the likelihood are
different, the forecast is different.
end
# however, I am a bit confused since I thought it should produce
for (j in 1:10)
ugarchforecast(myfit, n.ahead=1,external.forecasts = list(mregfor = dp[350+j],
vregfor = dp[350+j] ));
end
looking forward to your help.
Guoshi
redp.dat
Description: Binary data
_______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
