I am trying to estimate daily volatility of stock's return.
I have the below daily stock return data for 400 days:
#create data
return<-structure(c(0.00083, -0.00574, -0.00857, 6e-05, -0.01347, 0.00184,
0.01038, 0.00111, -0.00822, 0.00255, -0.00723, -0.00226, 0.01273,
0.00345, -0.00027, 0.00964, 0.00933, 0.00171, 0.00088, -0.00687,
0.00405, -0.00086, -0.00264, 0.00736, -0.00314, 0.00324, -0.00203,
-0.00236, -0.01163, 0.01262, -0.0069, 0.01079, 0.00447, 7e-04,
0.00853, -0.00071, 0.00312, 0.00107, 0.00174, -0.00403, 0.00247,
-0.00102, -0.00213, -0.00403, 0.00171, -0.00637, 0.00186, -0.01382,
0.0022, -0.00864, 0.00616, 0.00076, 0.00306, -0.00496, 0.00858,
0.00845, 0.00878, 0.00347, -0.00712, 0.00871, 0.00108, -0.00103,
0.00397, 0.00216, -0.00396, -0.00095, 0.00184, 0.00477, 0.00906,
-0.00304, -0.00658, -0.00577, 0.00487, -0.00104, 0.00491, 0.00463,
0.00353, 0.00282, -0.00026, -0.00144, -0.00714, -0.00401, 0.00637,
-0.00763, 0.00789, 0.00332, 0.00243, 0.00207, -4e-04, -0.00169,
0.00618, 0.00764, 0.00027, 0.00569, -0.00444, 0.00013, -0.00166,
-0.00281, -0.00366, -0.00222, 0.0019, 0.00373, 0.00036, 0.00527,
0.00028, -0.00559, 0.00535, 0.00125, 0.00781, -0.00037, -0.00352,
-0.00131, -0.00329, 0.00276, -1e-05, 0.00363, -4e-04, 0.00071,
-0.0082, -0.00554, -4e-04, -0.00142, -0.03342, -0.02079, 0.01411,
-0.00592, 0.02127, -0.00025, -0.0145, -0.00036, -0.00431, -0.00553,
-0.03135, 0.01845, -0.01748, -0.00658, 0.01555, 0.01079, 0.0105,
-0.00634, 0.00558, 0.00624, 0.02099, -0.00251, -0.00924, -0.0199,
-0.00148, -0.0076, 0.01054, 0.00222, -0.01678, -0.01832, 0.00304,
-0.00658, 0.01541, 0.00326, 0.02271, -0.0022, 0.00815, 0.01088,
-0.0329, -0.00152, -0.0236, 0.00176, -0.00036, 0.0054, -2e-04,
-0.01927, -0.02099, 9e-05, -0.01552, -0.0159, -0.0208, -0.02749,
0.0484, 0.00853, -0.00124, 0.00846, 0.00127, -0.02507, 0.03376,
0.00699, 0.00965, 0.00409, 0.00451, -0.00015, -0.00527, 0.01066,
0.00222, 0.00756, 0.0131, -0.01426, 0.0022, 0.00137, 0.00845,
-0.00788, -0.00146, 0.01543, 0.00856, 9e-04, 0.00675, 0.0047,
-0.00223, -0.0094, 0.00068, 0.00071, 0.01281, 0.00302, -0.00266,
0.01082, 0.0015, 0.00178, -0.00353, 0.00639, 0.00123, -0.00079,
-0.00054, -0.00283, 0.00687, -0.00389, -0.00113, -0.00655, -0.00816,
-0.00213, 0.01456, 0.00295, 0.00693, -0.00087, 0.00497, 0.0037,
-0.00013, -0.00295, 0.01079, -0.01916, -0.00084, 0.00716, -0.00466,
0.00358, 0.00671, 0.0115, 2e-05, 0.00215, 0.00208, 0.00463, 0.00105,
-0.00609, 0.00347, 4e-05, 0.00659, -0.00063, 0.00051, -0.00228,
0.00158, 0.00101, 0.0088, -0.00219, -0.00037, 0.00467, 0.00107,
0.00095, -0.00753, -0.00213, 0.00959, -0.00448, -0.01665, -0.00161,
-0.00303, 0.00371, -0.02443, 0.00798, 0.00582, 0.00886, -0.00585,
-0.00677, 0.00846, -0.00283, -0.01199, 0.00135, -0.00841, -0.00694,
0.0021, -0.01328, -0.00277, 0.02121, 0.00813, 0.00612, 0.01044,
0.00465, -0.00035, -0.00204, 0.00409, -0.00161, 0.00093, 0.00967,
0.00298, 0.00943, -0.00126, -0.00173, -0.00954, -0.00123, 0.00382,
0.00574, 0.00764, 0.00292, 0.00764, -0.00181, -0.00485, 0.00124,
0.0045, 0.00228, 0.00461, 0.00018, -0.00341, -0.00655, 0.00358,
-0.0062, 0.00282, 0.00682, 0.00468, -0.00528, 0.00736, -0.00162,
-0.00258, -0.01095, -0.00904, -0.00731, -0.03023, 0.01293, 0.00077,
0.01859, -0.00664, -0.01203, 0.01465, -0.02973, 0.00246, 0.01432,
0.01203, -0.00795, 0.00821, -0.00051, -0.02629, 0.01092, -0.00321,
0.00652, 0.01261, 0.00064, -0.00692, 0.01078, 0.01293, 0.00091,
-9e-05, 0.00032, 0.0072, 0.00287, -0.00072, -0.00314, 0.00258,
0.00034, 2e-05, -0.00491, -1e-04, -0.00845, 0.00614, -0.00243,
-0.00533, 0.00503, -0.01233, -0.01807, 0.00794, 0.01412, -0.00449,
-0.01568, 0.00906, 0.0064, 0.01088, -0.00139, 0.00991, -0.002,
0.00276, -0.00393, 0.00685, -0.00358, 0.00284, 0.00192, 0.00406,
0.00557, -0.00083, 0.00325, -0.00303, 0.00962, 0.0037, -0.00119,
7e-04, 0.00273, 0.00256, -0.00196, 0.00156, 0.00071, 0.00084,
0.00767), .Dim = c(400L, 1L), .Dimnames = list(NULL, "return"), .Tsp = c(1,
400, 1), class = "ts")
I am using rugarch package at R to estimate the daily volatility.
My code is as below:
library(rugarch)
#define the model
model_garch<-ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(1, 1)),
mean.model = list(armaOrder = c(0, 0), include.mean = FALSE),
distribution.model = "norm")
#get the fitted values for volatility
fitv<-ugarchfit(model_garch,return)
fitted<-fitv@fit$sigma
So I get an GARCH(1,1) model fitted values. Then I want to compare mean of observed standard deviations(where here it is absolute value of returns) and mean of fitted values:
> mean(abs(return))
[1] 0.006292475
> mean(fitted)
[1] 0.008541654
But they are very different from each other. I tried a lot different models, but I got almost the same result. I wasn't expecting that. My expectation was for individual days observed and fitted may deviate from each other; but, at overall( for me their means) should close to each other.
Is my expectation wrong? Or am I doing something wrong? Or am I interpretting something wrong?
I think, I am missing a very fundemantel concept about volatility. I am stuck here. I will be very glad for any help or explanation. Thanks a lot.