Good Morning,
I investigate the day-of –the-week of 11 indices in 11 countries using EGARCH model and rolling sample method with one sample interval case of 500 days. The main purpose of the empirical analysis is to determine whether there exist calendar effects or not by observing whether the t values exceed the quantile of the standard normal distribution z = 1.96 for confidence level of 5%. I want to use the same method as Zhang, Lai, Lin (2017), “the day-of-the-week effects of stocks markets in different countries”, Finance Research Letters 20. For the EGARCH model, I used Package “Rugarch”, and everything is good : spec2b<-ugarchspec(variance.model=list(model="eGARCH",garchOrder=c(1,1), external.regressors=L1), mean.model=list(armaOrder=c(0,0),archm=TRUE,archpow=1,external.regressors=L2), distribution.model = "std") fit2b<-ugarchfit(spec=spec2b,solver="hybrid", data=RENT) show(fit2b) But for the rolling sample method, with EGARCH(1,1), I thought using “ugarchroll” or “ugarchdistribution ”, to calculate the student t for each rolling window , but I do not get student t : dist <- ugarchdistribution(fit2b, n.sim = 500, n.start = 1, m.sim = 100, solver = "solnp") show(dist) or roll1=ugarchroll(spec1b,data = RENT,n.start = NULL,window.size = 500,solver = "solnp" ) show(roll1) Could you orient me to a solution ? Thank you very much Sandrine BOULERNE Maître de Conférences - Habilitation à Diriger des Recherches (HDR) IAE de Tours - Faculté de Droit, Économie et Sciences Sociales 50 av. Jean Portalis, BP 0607, 37206 TOURS Cedex 3 Téléphone : 02 47 36 10 47 www.iae.univ-tours.fr [[alternative HTML version deleted]] _______________________________________________ [hidden email] 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. |
Have you tried 'coef(roll1)'?
I think the documentation is reasonably clear (?ugarchroll). It returns an object of class 'uGARCHroll' (which is clickable in the documentation and will take you to the class help page). In the class help page you will see that one of the methods on the class is: "coef signature(object = "uGARCHroll"): Extracts the list of coefficients for each estimated window in the rolling backtest." Therefore, coef(roll1) will return the list of coefficient matrices per roll window, from which you can extract the shape parameter of the standardized Student distribution. Similarly, please read the documentation for ugarchdistribution. -Alexios On 9/11/2017 9:03 AM, Sandrine Boulerne wrote: > Good Morning, > > I investigate the day-of –the-week of 11 indices in 11 countries using > EGARCH model and rolling sample method with one sample interval case of > 500 days. The main purpose of the empirical analysis is to determine > whether there exist calendar effects or not by observing whether the /t/ > values exceed the quantile of the standard normal distribution z = 1.96 > for confidence level of 5%. I want to use the same method as Zhang, Lai, > Lin (2017), “the day-of-the-week effects of stocks markets in different > countries”, Finance Research Letters 20. > > For the EGARCH model, I used Package “Rugarch”, and everything is good: > > spec2b<-ugarchspec(variance.model=list(model="eGARCH",garchOrder=c(1,1), > external.regressors=L1), > mean.model=list(armaOrder=c(0,0),archm=TRUE,archpow=1,external.regressors=L2), > > distribution.model = "std") > > fit2b<-ugarchfit(spec=spec2b,solver="hybrid", data=RENT) > > show(fit2b) > > But for the rolling sample method, with EGARCH(1,1), I thought using > “ugarchroll” or “ugarchdistribution*”, ** to calculate the student /t/ > for each rolling window*, *but **I do not get student /t/* : > > dist <- ugarchdistribution(fit2b, n.sim = 500, n.start = 1, m.sim = 100, > solver = "solnp") > > show(dist) > > or > > roll1=ugarchroll(spec1b,data = RENT,n.start = NULL,window.size = > 500,solver = "solnp" ) > > show(roll1) > > Could you orient me to a solution ? > > Thank you very much > > > > Sandrine BOULERNE > Maître de Conférences - Habilitation à Diriger des Recherches (HDR) > IAE de Tours - Faculté de Droit, Économie et Sciences Sociales > 50 av. Jean Portalis, BP 0607, 37206 TOURS Cedex 3 > Téléphone : 02 47 36 10 47 > www.iae.univ-tours.fr > _______________________________________________ [hidden email] 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. |
Dear Alexios That's wonderful. Thanks to you I got what I was looking for several weeks. you are right, the documentation is very clear, but sometimes we do not see what may seem obvious to an expert eye. Thanks a lot Sandrine BOULERNE Maitre de Conferences - Habilitation à Diriger des Recherches (HDR) Co-responsable du thème Finance Contrôle Audit du Laboratoire de recherche VALLOREM IAE de Tours - Faculté de Droit, Économie et Sciences Sociales 50 av. Jean Portalis, BP 0607, 37206 TOURS Cedex 3 Téléphone : 02 47 36 10 47 www.iae.univ-tours.fr ----- Mail original ----- De: "alexios" <[hidden email]> À: "Sandrine Boulerne" <[hidden email]> Cc: [hidden email] Envoyé: Mardi 12 Septembre 2017 06:27:33 Objet: Re: To obtain the t student of each rolling window with EGARCH model Have you tried 'coef(roll1)'? I think the documentation is reasonably clear (?ugarchroll). It returns an object of class 'uGARCHroll' (which is clickable in the documentation and will take you to the class help page). In the class help page you will see that one of the methods on the class is: "coef signature(object = "uGARCHroll"): Extracts the list of coefficients for each estimated window in the rolling backtest." Therefore, coef(roll1) will return the list of coefficient matrices per roll window, from which you can extract the shape parameter of the standardized Student distribution. Similarly, please read the documentation for ugarchdistribution. -Alexios On 9/11/2017 9:03 AM, Sandrine Boulerne wrote: > Good Morning, > > I investigate the day-of –the-week of 11 indices in 11 countries using > EGARCH model and rolling sample method with one sample interval case of > 500 days. The main purpose of the empirical analysis is to determine > whether there exist calendar effects or not by observing whether the /t/ > values exceed the quantile of the standard normal distribution z = 1.96 > for confidence level of 5%. I want to use the same method as Zhang, Lai, > Lin (2017), “the day-of-the-week effects of stocks markets in different > countries”, Finance Research Letters 20. > > For the EGARCH model, I used Package “Rugarch”, and everything is good: > > spec2b<-ugarchspec(variance.model=list(model="eGARCH",garchOrder=c(1,1), > external.regressors=L1), > mean.model=list(armaOrder=c(0,0),archm=TRUE,archpow=1,external.regressors=L2), > > distribution.model = "std") > > fit2b<-ugarchfit(spec=spec2b,solver="hybrid", data=RENT) > > show(fit2b) > > But for the rolling sample method, with EGARCH(1,1), I thought using > “ugarchroll” or “ugarchdistribution*”, ** to calculate the student /t/ > for each rolling window*, *but **I do not get student /t/* : > > dist <- ugarchdistribution(fit2b, n.sim = 500, n.start = 1, m.sim = 100, > solver = "solnp") > > show(dist) > > or > > roll1=ugarchroll(spec1b,data = RENT,n.start = NULL,window.size = > 500,solver = "solnp" ) > > show(roll1) > > Could you orient me to a solution ? > > Thank you very much > > > > Sandrine BOULERNE > Maître de Conférences - Habilitation à Diriger des Recherches (HDR) > IAE de Tours - Faculté de Droit, Économie et Sciences Sociales > 50 av. Jean Portalis, BP 0607, 37206 TOURS Cedex 3 > Téléphone : 02 47 36 10 47 > www.iae.univ-tours.fr > _______________________________________________ [hidden email] 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. |
In reply to this post by alexios
Hello Alexios
I have advanced in my research and now I will want to get the student t from each past rolling window (500 days for each window) from 2001 to 2016 and not the student t from each forcasting rolling window. My question has evolved and is following your response of September 12th. For the EGARCH model, I used Package “Rugarch” : spec2b<-ugarchspec(variance.model=list(model="eGARCH",garchOrder=c(1,1),external.regressors=L1), mean.model=list(armaOrder=c(0,0),archm=TRUE,archpow=1,external.regressors=L2), distribution.model = "std") fit2b<-ugarchfit(spec=spec2b,solver="hybrid", data=RENT) show(fit2b) roll1=ugarchroll(spec2b,data = RENT,n.start = NULL,window.size=500,solver = "solnp" ) coeff(roll1) coef(roll1) allows me to get the student t from the 500 forecasting windows but not the student t from past windows (500 days per windows) from 2001 to 2016. Could you orient me to a solution ? I am looking for a solution for several days. Thank you very much Sandrine BOULERNE University of Tours www.iae.univ-tours.fr ----- Mail original ----- De: "alexios" <[hidden email]> À: "Sandrine Boulerne" <[hidden email]> Cc: [hidden email] Envoyé: Mardi 12 Septembre 2017 06:27:33 Objet: Re: To obtain the t student of each rolling window with EGARCH model Have you tried 'coef(roll1)'? I think the documentation is reasonably clear (?ugarchroll). It returns an object of class 'uGARCHroll' (which is clickable in the documentation and will take you to the class help page). In the class help page you will see that one of the methods on the class is: "coef signature(object = "uGARCHroll"): Extracts the list of coefficients for each estimated window in the rolling backtest." Therefore, coef(roll1) will return the list of coefficient matrices per roll window, from which you can extract the shape parameter of the standardized Student distribution. Similarly, please read the documentation for ugarchdistribution. -Alexios On 9/11/2017 9:03 AM, Sandrine Boulerne wrote: > Good Morning, > > I investigate the day-of –the-week of 11 indices in 11 countries using > EGARCH model and rolling sample method with one sample interval case of > 500 days. The main purpose of the empirical analysis is to determine > whether there exist calendar effects or not by observing whether the /t/ > values exceed the quantile of the standard normal distribution z = 1.96 > for confidence level of 5%. I want to use the same method as Zhang, Lai, > Lin (2017), “the day-of-the-week effects of stocks markets in different > countries”, Finance Research Letters 20. > > For the EGARCH model, I used Package “Rugarch”, and everything is good: > > spec2b<-ugarchspec(variance.model=list(model="eGARCH",garchOrder=c(1,1), > external.regressors=L1), > mean.model=list(armaOrder=c(0,0),archm=TRUE,archpow=1,external.regressors=L2), > > distribution.model = "std") > > fit2b<-ugarchfit(spec=spec2b,solver="hybrid", data=RENT) > > show(fit2b) > > But for the rolling sample method, with EGARCH(1,1), I thought using > “ugarchroll” or “ugarchdistribution*”, ** to calculate the student /t/ > for each rolling window*, *but **I do not get student /t/* : > > dist <- ugarchdistribution(fit2b, n.sim = 500, n.start = 1, m.sim = 100, > solver = "solnp") > > show(dist) > > or > > roll1=ugarchroll(spec1b,data = RENT,n.start = NULL,window.size = > 500,solver = "solnp" ) > > show(roll1) > > Could you orient me to a solution ? > > Thank you very much > > > > Sandrine BOULERNE > Maître de Conférences - Habilitation à Diriger des Recherches (HDR) > IAE de Tours - Faculté de Droit, Économie et Sciences Sociales > 50 av. Jean Portalis, BP 0607, 37206 TOURS Cedex 3 > Téléphone : 02 47 36 10 47 > www.iae.univ-tours.fr > _______________________________________________ [hidden email] 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. |
Hi Sandrine,
Not sure if this is what you are after: ##### # reproducible example: library(rugarch) library(xts) data(sp500ret) spx = xts(as.numeric(sp500ret[,1]), as.Date(rownames(sp500ret))) spec2b<-ugarchspec(variance.model=list(model="eGARCH",garchOrder=c(1,1)),mean.model=list(armaOrder=c(0,0)), distribution.model = "std") roll1=ugarchroll(spec2b,data=spx,n.start=NULL,window.size=500,solver="solnp") cf=coef(roll1) st=do.call(rbind, lapply(1:length(cf), function(i){ xts(cf[[i]]$coef["shape",1], as.Date(cf[[i]]$index)) })) st = na.locf(cbind(spx[paste0(index(st[1]),"/",st[length(st)])], st))[,2] ##### Alexios On 11/23/2017 12:30 PM, Sandrine Boulerne wrote: > Hello Alexios > > I have advanced in my research and now I will want to get the student t from each past rolling window (500 days for each window) from 2001 to 2016 and not the student t from each forcasting rolling window. > My question has evolved and is following your response of September 12th. > > For the EGARCH model, I used Package “Rugarch” : > > spec2b<-ugarchspec(variance.model=list(model="eGARCH",garchOrder=c(1,1),external.regressors=L1), mean.model=list(armaOrder=c(0,0),archm=TRUE,archpow=1,external.regressors=L2), distribution.model = "std") > fit2b<-ugarchfit(spec=spec2b,solver="hybrid", data=RENT) > show(fit2b) > roll1=ugarchroll(spec2b,data = RENT,n.start = NULL,window.size=500,solver = "solnp" ) > coeff(roll1) > > coef(roll1) allows me to get the student t from the 500 forecasting windows but not the student t from past windows (500 days per windows) from 2001 to 2016. > > Could you orient me to a solution ? I am looking for a solution for several days. > > Thank you very much > > Sandrine BOULERNE > University of Tours > www.iae.univ-tours.fr > > > ----- Mail original ----- > De: "alexios" <[hidden email]> > À: "Sandrine Boulerne" <[hidden email]> > Cc: [hidden email] > Envoyé: Mardi 12 Septembre 2017 06:27:33 > Objet: Re: To obtain the t student of each rolling window with EGARCH model > > Have you tried 'coef(roll1)'? > > I think the documentation is reasonably clear (?ugarchroll). > It returns an object of class 'uGARCHroll' (which is clickable in the > documentation and will take you to the class help page). > In the class help page you will see that one of the methods on the class > is: > > "coef > signature(object = "uGARCHroll"): Extracts the list of coefficients for > each estimated window in the rolling backtest." > > Therefore, coef(roll1) will return the list of coefficient matrices > per roll window, from which you can extract the shape parameter of the > standardized Student distribution. > > Similarly, please read the documentation for ugarchdistribution. > > > -Alexios > > On 9/11/2017 9:03 AM, Sandrine Boulerne wrote: >> Good Morning, >> >> I investigate the day-of –the-week of 11 indices in 11 countries using >> EGARCH model and rolling sample method with one sample interval case of >> 500 days. The main purpose of the empirical analysis is to determine >> whether there exist calendar effects or not by observing whether the /t/ >> values exceed the quantile of the standard normal distribution z = 1.96 >> for confidence level of 5%. I want to use the same method as Zhang, Lai, >> Lin (2017), “the day-of-the-week effects of stocks markets in different >> countries”, Finance Research Letters 20. >> >> For the EGARCH model, I used Package “Rugarch”, and everything is good: >> >> spec2b<-ugarchspec(variance.model=list(model="eGARCH",garchOrder=c(1,1), >> external.regressors=L1), >> mean.model=list(armaOrder=c(0,0),archm=TRUE,archpow=1,external.regressors=L2), >> >> distribution.model = "std") >> >> fit2b<-ugarchfit(spec=spec2b,solver="hybrid", data=RENT) >> >> show(fit2b) >> >> But for the rolling sample method, with EGARCH(1,1), I thought using >> “ugarchroll” or “ugarchdistribution*”, ** to calculate the student /t/ >> for each rolling window*, *but **I do not get student /t/* : >> >> dist <- ugarchdistribution(fit2b, n.sim = 500, n.start = 1, m.sim = 100, >> solver = "solnp") >> >> show(dist) >> >> or >> >> roll1=ugarchroll(spec1b,data = RENT,n.start = NULL,window.size = >> 500,solver = "solnp" ) >> >> show(roll1) >> >> Could you orient me to a solution ? >> >> Thank you very much >> >> >> >> Sandrine BOULERNE >> Maître de Conférences - Habilitation à Diriger des Recherches (HDR) >> IAE de Tours - Faculté de Droit, Économie et Sciences Sociales >> 50 av. Jean Portalis, BP 0607, 37206 TOURS Cedex 3 >> Téléphone : 02 47 36 10 47 >> www.iae.univ-tours.fr >> > _______________________________________________ [hidden email] 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. |
Hi Alexios,
Thank for your example with sp500ret, but we get only the t values from 500 rolling windows. I will try to explain myself with a simpler example for me. If the samples include 7 data: {1, 2, 3, 4, 5, 6, 7} and we fix the rolling interval with length of 4, the first sample subinterval is {1, 2, 3, 4}; the second sample subinterval is {2, 3, 4, 5}, etc. The length of the rolling sample interval used in my paper is 500 days. It is assumed that the average trading days in one year is about 250 days. Therefore, 500 days represent the number of trading days in 2 years, I investigate the day-of-the-week effects of the 10 indices in 10 countries using GARCH model and rolling sample method with one sample interval case of 500 days, from 2001 to 2016. The main purpose of the empirical analysis in my paper is to determine whether there exist calendar effects or not by observing whether the t values in the graph exceed the quantile of the standard normal distribution, z(α), for a given confidence level α. For example, z(0.005) = 1.96. So, I would like to get 3750 t values (15 years * 500 days in 2 years), in using : spec2b<-ugarchspec(variance.model=list(model="eGARCH",garchOrder=c(1,1)),mean.model=list(armaOrder=c(0,0)), distribution.model = "std") roll1=ugarchroll(spec2b,data=spx,n.start=NULL,window.size=500,solver="solnp") #perhaps ??? cf=coef(roll1) # from 2001 to 2016 Thank you very much for your help Sandrine ----- Mail original ----- De: "alexios" <[hidden email]> À: "Sandrine Boulerne" <[hidden email]> Cc: [hidden email] Envoyé: Vendredi 24 Novembre 2017 04:08:12 Objet: Re: To obtain the t student of each rolling window with EGARCH model Hi Sandrine, Not sure if this is what you are after: ##### # reproducible example: library(rugarch) library(xts) data(sp500ret) spx = xts(as.numeric(sp500ret[,1]), as.Date(rownames(sp500ret))) spec2b<-ugarchspec(variance.model=list(model="eGARCH",garchOrder=c(1,1)),mean.model=list(armaOrder=c(0,0)), distribution.model = "std") roll1=ugarchroll(spec2b,data=spx,n.start=NULL,window.size=500,solver="solnp") cf=coef(roll1) st=do.call(rbind, lapply(1:length(cf), function(i){ xts(cf[[i]]$coef["shape",1], as.Date(cf[[i]]$index)) })) st = na.locf(cbind(spx[paste0(index(st[1]),"/",st[length(st)])], st))[,2] ##### Alexios On 11/23/2017 12:30 PM, Sandrine Boulerne wrote: > Hello Alexios > > I have advanced in my research and now I will want to get the student t from each past rolling window (500 days for each window) from 2001 to 2016 and not the student t from each forcasting rolling window. > My question has evolved and is following your response of September 12th. > > For the EGARCH model, I used Package “Rugarch” : > > spec2b<-ugarchspec(variance.model=list(model="eGARCH",garchOrder=c(1,1),external.regressors=L1), mean.model=list(armaOrder=c(0,0),archm=TRUE,archpow=1,external.regressors=L2), distribution.model = "std") > fit2b<-ugarchfit(spec=spec2b,solver="hybrid", data=RENT) > show(fit2b) > roll1=ugarchroll(spec2b,data = RENT,n.start = NULL,window.size=500,solver = "solnp" ) > coeff(roll1) > > coef(roll1) allows me to get the student t from the 500 forecasting windows but not the student t from past windows (500 days per windows) from 2001 to 2016. > > Could you orient me to a solution ? I am looking for a solution for several days. > > Thank you very much > > Sandrine BOULERNE > University of Tours > www.iae.univ-tours.fr > > > ----- Mail original ----- > De: "alexios" <[hidden email]> > À: "Sandrine Boulerne" <[hidden email]> > Cc: [hidden email] > Envoyé: Mardi 12 Septembre 2017 06:27:33 > Objet: Re: To obtain the t student of each rolling window with EGARCH model > > Have you tried 'coef(roll1)'? > > I think the documentation is reasonably clear (?ugarchroll). > It returns an object of class 'uGARCHroll' (which is clickable in the > documentation and will take you to the class help page). > In the class help page you will see that one of the methods on the class > is: > > "coef > signature(object = "uGARCHroll"): Extracts the list of coefficients for > each estimated window in the rolling backtest." > > Therefore, coef(roll1) will return the list of coefficient matrices > per roll window, from which you can extract the shape parameter of the > standardized Student distribution. > > Similarly, please read the documentation for ugarchdistribution. > > > -Alexios > > On 9/11/2017 9:03 AM, Sandrine Boulerne wrote: >> Good Morning, >> >> I investigate the day-of –the-week of 11 indices in 11 countries using >> EGARCH model and rolling sample method with one sample interval case of >> 500 days. The main purpose of the empirical analysis is to determine >> whether there exist calendar effects or not by observing whether the /t/ >> values exceed the quantile of the standard normal distribution z = 1.96 >> for confidence level of 5%. I want to use the same method as Zhang, Lai, >> Lin (2017), “the day-of-the-week effects of stocks markets in different >> countries”, Finance Research Letters 20. >> >> For the EGARCH model, I used Package “Rugarch”, and everything is good: >> >> spec2b<-ugarchspec(variance.model=list(model="eGARCH",garchOrder=c(1,1), >> external.regressors=L1), >> mean.model=list(armaOrder=c(0,0),archm=TRUE,archpow=1,external.regressors=L2), >> >> distribution.model = "std") >> >> fit2b<-ugarchfit(spec=spec2b,solver="hybrid", data=RENT) >> >> show(fit2b) >> >> But for the rolling sample method, with EGARCH(1,1), I thought using >> “ugarchroll” or “ugarchdistribution*”, ** to calculate the student /t/ >> for each rolling window*, *but **I do not get student /t/* : >> >> dist <- ugarchdistribution(fit2b, n.sim = 500, n.start = 1, m.sim = 100, >> solver = "solnp") >> >> show(dist) >> >> or >> >> roll1=ugarchroll(spec1b,data = RENT,n.start = NULL,window.size = >> 500,solver = "solnp" ) >> >> show(roll1) >> >> Could you orient me to a solution ? >> >> Thank you very much >> >> >> >> Sandrine BOULERNE >> Maître de Conférences - Habilitation à Diriger des Recherches (HDR) >> IAE de Tours - Faculté de Droit, Économie et Sciences Sociales >> 50 av. Jean Portalis, BP 0607, 37206 TOURS Cedex 3 >> Téléphone : 02 47 36 10 47 >> www.iae.univ-tours.fr >> > _______________________________________________ [hidden email] 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. |
----- Mail original ----- De: "Sandrine Boulerne" <[hidden email]> À: "alexios" <[hidden email]> Cc: [hidden email] Envoyé: Vendredi 24 Novembre 2017 10:55:46 Objet: Re: To obtain the t student of each rolling window with EGARCH model Hi Alexios, Thank for your example with sp500ret, but we get only the t values from 500 rolling windows. I will try to explain myself with a simpler example for me. If the samples include 7 data: {1, 2, 3, 4, 5, 6, 7} and we fix the rolling interval with length of 4, the first sample subinterval is {1, 2, 3, 4}; the second sample subinterval is {2, 3, 4, 5}, etc. The length of the rolling sample interval used in my paper is 500 days. It is assumed that the average trading days in one year is about 250 days. Therefore, 500 days represent the number of trading days in 2 years, I investigate the day-of-the-week effects of the 10 indices in 10 countries using GARCH model and rolling sample method with one sample interval case of 500 days, from 2001 to 2016. The main purpose of the empirical analysis in my paper is to determine whether there exist calendar effects or not by observing whether the t values in the graph exceed the quantile of the standard normal distribution, z(α), for a given confidence level α. For example, z(0.005) = 1.96. So, I would like to get 3750 t values (15 years * 500 days in 2 years), in using : spec2b<-ugarchspec(variance.model=list(model="eGARCH",garchOrder=c(1,1)),mean.model=list(armaOrder=c(0,0)), distribution.model = "std") roll1=ugarchroll(spec2b,data=spx,n.start=NULL,window.size=500,solver="solnp") #perhaps ??? cf=coef(roll1) # from 2001 to 2016 Thank you very much for your help Sandrine ----- Mail original ----- De: "alexios" <[hidden email]> À: "Sandrine Boulerne" <[hidden email]> Cc: [hidden email] Envoyé: Vendredi 24 Novembre 2017 04:08:12 Objet: Re: To obtain the t student of each rolling window with EGARCH model Hi Sandrine, Not sure if this is what you are after: ##### # reproducible example: library(rugarch) library(xts) data(sp500ret) spx = xts(as.numeric(sp500ret[,1]), as.Date(rownames(sp500ret))) spec2b<-ugarchspec(variance.model=list(model="eGARCH",garchOrder=c(1,1)),mean.model=list(armaOrder=c(0,0)), distribution.model = "std") roll1=ugarchroll(spec2b,data=spx,n.start=NULL,window.size=500,solver="solnp") cf=coef(roll1) st=do.call(rbind, lapply(1:length(cf), function(i){ xts(cf[[i]]$coef["shape",1], as.Date(cf[[i]]$index)) })) st = na.locf(cbind(spx[paste0(index(st[1]),"/",st[length(st)])], st))[,2] ##### Alexios On 11/23/2017 12:30 PM, Sandrine Boulerne wrote: > Hello Alexios > > I have advanced in my research and now I will want to get the student t from each past rolling window (500 days for each window) from 2001 to 2016 and not the student t from each forcasting rolling window. > My question has evolved and is following your response of September 12th. > > For the EGARCH model, I used Package “Rugarch” : > > spec2b<-ugarchspec(variance.model=list(model="eGARCH",garchOrder=c(1,1),external.regressors=L1), mean.model=list(armaOrder=c(0,0),archm=TRUE,archpow=1,external.regressors=L2), distribution.model = "std") > fit2b<-ugarchfit(spec=spec2b,solver="hybrid", data=RENT) > show(fit2b) > roll1=ugarchroll(spec2b,data = RENT,n.start = NULL,window.size=500,solver = "solnp" ) > coeff(roll1) > > coef(roll1) allows me to get the student t from the 500 forecasting windows but not the student t from past windows (500 days per windows) from 2001 to 2016. > > Could you orient me to a solution ? I am looking for a solution for several days. > > Thank you very much > > Sandrine BOULERNE > University of Tours > www.iae.univ-tours.fr > > > ----- Mail original ----- > De: "alexios" <[hidden email]> > À: "Sandrine Boulerne" <[hidden email]> > Cc: [hidden email] > Envoyé: Mardi 12 Septembre 2017 06:27:33 > Objet: Re: To obtain the t student of each rolling window with EGARCH model > > Have you tried 'coef(roll1)'? > > I think the documentation is reasonably clear (?ugarchroll). > It returns an object of class 'uGARCHroll' (which is clickable in the > documentation and will take you to the class help page). > In the class help page you will see that one of the methods on the class > is: > > "coef > signature(object = "uGARCHroll"): Extracts the list of coefficients for > each estimated window in the rolling backtest." > > Therefore, coef(roll1) will return the list of coefficient matrices > per roll window, from which you can extract the shape parameter of the > standardized Student distribution. > > Similarly, please read the documentation for ugarchdistribution. > > > -Alexios > > On 9/11/2017 9:03 AM, Sandrine Boulerne wrote: >> Good Morning, >> >> I investigate the day-of –the-week of 11 indices in 11 countries using >> EGARCH model and rolling sample method with one sample interval case of >> 500 days. The main purpose of the empirical analysis is to determine >> whether there exist calendar effects or not by observing whether the /t/ >> values exceed the quantile of the standard normal distribution z = 1.96 >> for confidence level of 5%. I want to use the same method as Zhang, Lai, >> Lin (2017), “the day-of-the-week effects of stocks markets in different >> countries”, Finance Research Letters 20. >> >> For the EGARCH model, I used Package “Rugarch”, and everything is good: >> >> spec2b<-ugarchspec(variance.model=list(model="eGARCH",garchOrder=c(1,1), >> external.regressors=L1), >> mean.model=list(armaOrder=c(0,0),archm=TRUE,archpow=1,external.regressors=L2), >> >> distribution.model = "std") >> >> fit2b<-ugarchfit(spec=spec2b,solver="hybrid", data=RENT) >> >> show(fit2b) >> >> But for the rolling sample method, with EGARCH(1,1), I thought using >> “ugarchroll” or “ugarchdistribution*”, ** to calculate the student /t/ >> for each rolling window*, *but **I do not get student /t/* : >> >> dist <- ugarchdistribution(fit2b, n.sim = 500, n.start = 1, m.sim = 100, >> solver = "solnp") >> >> show(dist) >> >> or >> >> roll1=ugarchroll(spec1b,data = RENT,n.start = NULL,window.size = >> 500,solver = "solnp" ) >> >> show(roll1) >> >> Could you orient me to a solution ? >> >> Thank you very much >> >> >> >> Sandrine BOULERNE >> Maître de Conférences - Habilitation à Diriger des Recherches (HDR) >> IAE de Tours - Faculté de Droit, Économie et Sciences Sociales >> 50 av. Jean Portalis, BP 0607, 37206 TOURS Cedex 3 >> Téléphone : 02 47 36 10 47 >> www.iae.univ-tours.fr >> > _______________________________________________ [hidden email] 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. |
Free forum by Nabble - Free Resume Builder | Edit this page |