├── DESCRIPTION ├── MD5 ├── NAMESPACE ├── NEWS.md ├── R ├── data.R ├── functions.R └── midas_functions.R ├── build └── partial.rdb ├── data ├── indpro.rda ├── rv5.rda ├── sp500.rda └── vix.rda ├── inst ├── CITATION └── REFERENCES.bib └── man ├── DAGM_2M_cond_vol.Rd ├── DAGM_2M_cond_vol_no_skew.Rd ├── DAGM_2M_loglik.Rd ├── DAGM_2M_loglik_no_skew.Rd ├── DAGM_2M_long_run.Rd ├── DAGM_2M_long_run_no_skew.Rd ├── DAGM_X_cond_vol.Rd ├── DAGM_X_cond_vol_no_skew.Rd ├── DAGM_X_loglik.Rd ├── DAGM_X_loglik_no_skew.Rd ├── DAGM_X_long_run_vol.Rd ├── DAGM_X_long_run_vol_no_skew.Rd ├── DAGM_cond_vol.Rd ├── DAGM_cond_vol_no_skew.Rd ├── DAGM_loglik.Rd ├── DAGM_loglik_no_skew.Rd ├── DAGM_long_run_vol.Rd ├── DAGM_long_run_vol_no_skew.Rd ├── GM_2M_cond_vol.Rd ├── GM_2M_cond_vol_no_skew.Rd ├── GM_2M_loglik.Rd ├── GM_2M_loglik_no_skew.Rd ├── GM_2M_long_run_vol.Rd ├── GM_2M_long_run_vol_no_skew.Rd ├── GM_X_cond_vol.Rd ├── GM_X_cond_vol_no_skew.Rd ├── GM_X_loglik.Rd ├── GM_X_loglik_no_skew.Rd ├── GM_X_long_run_vol.Rd ├── GM_X_long_run_vol_no_skew.Rd ├── GM_cond_vol.Rd ├── GM_cond_vol_no_skew.Rd ├── GM_loglik.Rd ├── GM_loglik_no_skew.Rd ├── GM_long_run_vol.Rd ├── GM_long_run_vol_no_skew.Rd ├── Inf_criteria.Rd ├── LF_f.Rd ├── MEM_MIDAS_X_loglik.Rd ├── MEM_MIDAS_X_loglik_no_skew.Rd ├── MEM_MIDAS_X_lr_pred.Rd ├── MEM_MIDAS_X_lr_pred_no_skew.Rd ├── MEM_MIDAS_X_pred.Rd ├── MEM_MIDAS_X_pred_no_skew.Rd ├── MEM_MIDAS_loglik.Rd ├── MEM_MIDAS_loglik_no_skew.Rd ├── MEM_MIDAS_lr_pred.Rd ├── MEM_MIDAS_lr_pred_no_skew.Rd ├── MEM_MIDAS_pred.Rd ├── MEM_MIDAS_pred_no_skew.Rd ├── MEM_QMLE_sd.Rd ├── MEM_X_loglik.Rd ├── MEM_X_loglik_no_skew.Rd ├── MEM_X_pred.Rd ├── MEM_X_pred_no_skew.Rd ├── MEM_loglik.Rd ├── MEM_loglik_no_skew.Rd ├── MEM_pred.Rd ├── MEM_pred_no_skew.Rd ├── QMLE_sd.Rd ├── beta_function.Rd ├── exp_almon.Rd ├── indpro.Rd ├── multi_step_ahead_pred.Rd ├── mv_into_mat.Rd ├── print.rumidas.Rd ├── rv5.Rd ├── sp500.Rd ├── sum_X_f.Rd ├── summary.rumidas.Rd ├── ugmfit.Rd ├── umemfit.Rd └── vix.Rd /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: rumidas 2 | Title: Univariate GARCH-MIDAS, Double-Asymmetric GARCH-MIDAS and 3 | MEM-MIDAS 4 | Version: 0.1.3 5 | Authors@R: person("Vincenzo", "Candila", email="vcandila@unisa.it", role=c("aut", "cre")) 6 | Description: Adds the MIxing-Data Sampling (MIDAS, Ghysels et al. (2007) ) components to a variety of GARCH and MEM (Engle (2002) , Engle and Gallo (2006) , and Amendola et al. (2024) ) models, with the aim of predicting the volatility with additional low-frequency (that is, MIDAS) terms. The estimation takes place through simple functions, which provide in-sample and (if present) and out-of-sample evaluations. 'rumidas' also offers a summary tool, which synthesizes the main information of the estimated model. There is also the possibility of generating one-step-ahead and multi-step-ahead forecasts. 7 | License: GPL-3 8 | Encoding: UTF-8 9 | LazyData: true 10 | RoxygenNote: 7.2.3 11 | RdMacros: Rdpack 12 | Depends: R (>= 4.0.0), maxLik (>= 1.3-8) 13 | Imports: roll (>= 1.1.4), xts (>= 0.12.0), tseries (>= 0.10.47), Rdpack 14 | (>= 1.0.0), lubridate (>= 1.7.9), zoo (>= 1.8.8), stats (>= 15 | 4.0.2), utils (>= 4.0.2) 16 | Suggests: knitr, rmarkdown 17 | NeedsCompilation: no 18 | Packaged: 2025-03-18 11:42:25 UTC; candi 19 | Author: Vincenzo Candila [aut, cre] 20 | Maintainer: Vincenzo Candila 21 | Repository: CRAN 22 | Date/Publication: 2025-03-18 13:40:15 UTC 23 | -------------------------------------------------------------------------------- /MD5: -------------------------------------------------------------------------------- 1 | 4446ae980fef107d59f755da2c2885ad *DESCRIPTION 2 | 08257d07f441b4ab557b6e5bace8d307 *NAMESPACE 3 | dcdbb9e44ea4ecf8c71d07e8e0653491 *NEWS.md 4 | 452449a2d4fd1a119c7e9f6ffd25f42f *R/data.R 5 | 55b1c2610097d962e8f45d9f857594c7 *R/functions.R 6 | 99ea6d5bd6cb164b0a1fb3339777b873 *R/midas_functions.R 7 | 1a86f64ed82e3bb8625754691ac6ed19 *build/partial.rdb 8 | 254a6f66b1d2df06a4b75c239048c0a5 *data/indpro.rda 9 | c01d54cbe7090e0fdd12ea9248256d47 *data/rv5.rda 10 | 0b670ef5426f606ec9e3c0179e8d0f66 *data/sp500.rda 11 | 27d95f5a78e5465f6ee8d650b63ae81c *data/vix.rda 12 | d26d4edfc2fcda56ebfe9c5a6d7723ca *inst/CITATION 13 | 3e72f9f8ac018554312e27e0a05ae299 *inst/REFERENCES.bib 14 | e3b788d15ffa4f2efbb3fea0065e1250 *man/DAGM_2M_cond_vol.Rd 15 | 3056cc904cb4259abacb20696c7973e9 *man/DAGM_2M_cond_vol_no_skew.Rd 16 | 0199e99134fc54c1bcd96b8bc6776eb0 *man/DAGM_2M_loglik.Rd 17 | 31d91dccdb76e5220fa3a8e2506fd917 *man/DAGM_2M_loglik_no_skew.Rd 18 | 3099e42a8debd29f9557af15e7ca05dc *man/DAGM_2M_long_run.Rd 19 | e81ebd02387f255de85d793fa0c02070 *man/DAGM_2M_long_run_no_skew.Rd 20 | 3c1e0372e3852ed0b2e3eaf255e81a9f *man/DAGM_X_cond_vol.Rd 21 | 6c166815032e1a97c8990404f90f3e3c *man/DAGM_X_cond_vol_no_skew.Rd 22 | adfabb4a7dd2cbb71f6ed0e9dad6cb13 *man/DAGM_X_loglik.Rd 23 | 8143b5c08cd2c1100477c006d11166dc *man/DAGM_X_loglik_no_skew.Rd 24 | 2301258ece8b79684980bc6522b9d023 *man/DAGM_X_long_run_vol.Rd 25 | 7f17201b50a6e1f5a5444f9b3e063b58 *man/DAGM_X_long_run_vol_no_skew.Rd 26 | 48b38f9132ff467e3cbf3e8f378cc54e *man/DAGM_cond_vol.Rd 27 | 1d4ac2dffad1d8644ba33f5090b4babd *man/DAGM_cond_vol_no_skew.Rd 28 | 22d559e4324ac576af6ca07a1be34d7b *man/DAGM_loglik.Rd 29 | b965daf8ae67153642de5f4595e9d382 *man/DAGM_loglik_no_skew.Rd 30 | d223e133738adfa6715d18daf0f6b75a *man/DAGM_long_run_vol.Rd 31 | 0e2362d5bacf489543da8eebf7503474 *man/DAGM_long_run_vol_no_skew.Rd 32 | d5c6c5f76e94af0dd934d3034fda2325 *man/GM_2M_cond_vol.Rd 33 | 4f0f87d469b34fb98cddf6622f1364bd *man/GM_2M_cond_vol_no_skew.Rd 34 | 1a6ff74527befc697671637856dd9010 *man/GM_2M_loglik.Rd 35 | 0a8e7522425995e061ad9d087bd1f951 *man/GM_2M_loglik_no_skew.Rd 36 | af7e34d99bbb4554118b1af7d9a38919 *man/GM_2M_long_run_vol.Rd 37 | 13744da84cd90d0fe0ca1b70384ea029 *man/GM_2M_long_run_vol_no_skew.Rd 38 | 667cec67b3da382120fa900ae80b9fa8 *man/GM_X_cond_vol.Rd 39 | 5cc6efc90eff7a0acc04c42e4f83c8b1 *man/GM_X_cond_vol_no_skew.Rd 40 | d15f4a43d4753fdddff7c660dfbe9766 *man/GM_X_loglik.Rd 41 | 04016be6412d2e537a6c7c8c33cd87da *man/GM_X_loglik_no_skew.Rd 42 | 518eed96fa3f8fdd7a031962b189d2e6 *man/GM_X_long_run_vol.Rd 43 | 25470ecd28ffdb37a53ef6bbf72e37d4 *man/GM_X_long_run_vol_no_skew.Rd 44 | a39fdc68918a41e53763027efc3161d8 *man/GM_cond_vol.Rd 45 | a7f3df7462e7a681e6bfbc2e00fab101 *man/GM_cond_vol_no_skew.Rd 46 | af917d646a373c21286c1fa332bcaad1 *man/GM_loglik.Rd 47 | a423b9c272dd27a8f6e61f349bf30de1 *man/GM_loglik_no_skew.Rd 48 | 040849f1c5df4821c0ec806a481cad06 *man/GM_long_run_vol.Rd 49 | 10536146bb0b4bec47ef5abe83f7520f *man/GM_long_run_vol_no_skew.Rd 50 | f5fc7a6ea3fc2ad9e2225e120f851089 *man/Inf_criteria.Rd 51 | 9a11e001882c050029c6b83e1230bb56 *man/LF_f.Rd 52 | 2570164052920e5a7a3c11633ef75161 *man/MEM_MIDAS_X_loglik.Rd 53 | a931da346ac6a0646717881cd8959849 *man/MEM_MIDAS_X_loglik_no_skew.Rd 54 | 74e467d552a5b6782744d951c0832e43 *man/MEM_MIDAS_X_lr_pred.Rd 55 | 92ee4402b7dc8c244b8f00cceb08da5c *man/MEM_MIDAS_X_lr_pred_no_skew.Rd 56 | 982c2cd60f7d17669ceab021abbb5f9a *man/MEM_MIDAS_X_pred.Rd 57 | 983bad00ccad4de4150c3ca4bdadf078 *man/MEM_MIDAS_X_pred_no_skew.Rd 58 | 431f4e9d6fbbc12b5c660d8795e58bee *man/MEM_MIDAS_loglik.Rd 59 | 30c0ce4721a5e7c6415779eee9190630 *man/MEM_MIDAS_loglik_no_skew.Rd 60 | 26adce0025bc33058067bc7434945b75 *man/MEM_MIDAS_lr_pred.Rd 61 | 2305175bcc517424f42aba2aab824994 *man/MEM_MIDAS_lr_pred_no_skew.Rd 62 | 464935adac6da386faafbb4b58a12365 *man/MEM_MIDAS_pred.Rd 63 | e2aa7a051c3366586e1c7639e7cb42af *man/MEM_MIDAS_pred_no_skew.Rd 64 | 679f093800d580d6a0a9af000ab5f26d *man/MEM_QMLE_sd.Rd 65 | 4c7a80df38b8e830aa4bc756639dd860 *man/MEM_X_loglik.Rd 66 | 472c97f5110a6029fc18d501ff5a7bed *man/MEM_X_loglik_no_skew.Rd 67 | ad6cfb6ab5048a2099af133fe88dc767 *man/MEM_X_pred.Rd 68 | da38ad7283123e3b40c535598da7413d *man/MEM_X_pred_no_skew.Rd 69 | 8e9c142cf1f25b98637ca6c5f66ef148 *man/MEM_loglik.Rd 70 | fb6528f1757e9da740c62a6f533cc6e2 *man/MEM_loglik_no_skew.Rd 71 | 637e9756ef04b1560f0c066aab68c0bb *man/MEM_pred.Rd 72 | 9ddfdddaed24070e6c031121d5e86a62 *man/MEM_pred_no_skew.Rd 73 | 7dd08e37da77ef031fc68e9cbd476e42 *man/QMLE_sd.Rd 74 | d4d3d52dbb0876ea167bbfd2dd907c07 *man/beta_function.Rd 75 | 70753b26d825fc529371e3bd64c551af *man/exp_almon.Rd 76 | 10887743713f4adea468a99f177b1398 *man/indpro.Rd 77 | 07bcfeae5bb390c2d6b1491a9a96f83e *man/multi_step_ahead_pred.Rd 78 | 05e680f280dba3de51972362486b2d0c *man/mv_into_mat.Rd 79 | 0d659d23b6360b55dae923186cba8be4 *man/print.rumidas.Rd 80 | 10b835ea9dbc448e92bf3bc19dd08cc8 *man/rv5.Rd 81 | c0248a54569590f2afcd6181e4c7bdbb *man/sp500.Rd 82 | 74e37cc14327cb655528681747897971 *man/sum_X_f.Rd 83 | 428ffc6d1df449ceb53499cba73684e6 *man/summary.rumidas.Rd 84 | 3a949573535770e21438a854b634fd48 *man/ugmfit.Rd 85 | caeed62039bae43e439ac70023ac82ea *man/umemfit.Rd 86 | 5413e40cf1036ad71a04bc693d178836 *man/vix.Rd 87 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | S3method(print,rumidas) 4 | S3method(summary,rumidas) 5 | export(DAGM_2M_cond_vol) 6 | export(DAGM_2M_cond_vol_no_skew) 7 | export(DAGM_2M_loglik) 8 | export(DAGM_2M_loglik_no_skew) 9 | export(DAGM_2M_long_run) 10 | export(DAGM_2M_long_run_no_skew) 11 | export(DAGM_X_cond_vol) 12 | export(DAGM_X_cond_vol_no_skew) 13 | export(DAGM_X_loglik) 14 | export(DAGM_X_loglik_no_skew) 15 | export(DAGM_X_long_run_vol) 16 | export(DAGM_X_long_run_vol_no_skew) 17 | export(DAGM_cond_vol) 18 | export(DAGM_cond_vol_no_skew) 19 | export(DAGM_loglik) 20 | export(DAGM_loglik_no_skew) 21 | export(DAGM_long_run_vol) 22 | export(DAGM_long_run_vol_no_skew) 23 | export(GM_2M_cond_vol) 24 | export(GM_2M_cond_vol_no_skew) 25 | export(GM_2M_loglik) 26 | export(GM_2M_loglik_no_skew) 27 | export(GM_2M_long_run_vol) 28 | export(GM_2M_long_run_vol_no_skew) 29 | export(GM_X_cond_vol) 30 | export(GM_X_cond_vol_no_skew) 31 | export(GM_X_loglik) 32 | export(GM_X_loglik_no_skew) 33 | export(GM_X_long_run_vol) 34 | export(GM_X_long_run_vol_no_skew) 35 | export(GM_cond_vol) 36 | export(GM_cond_vol_no_skew) 37 | export(GM_loglik) 38 | export(GM_loglik_no_skew) 39 | export(GM_long_run_vol) 40 | export(GM_long_run_vol_no_skew) 41 | export(MEM_MIDAS_X_loglik) 42 | export(MEM_MIDAS_X_loglik_no_skew) 43 | export(MEM_MIDAS_X_lr_pred) 44 | export(MEM_MIDAS_X_lr_pred_no_skew) 45 | export(MEM_MIDAS_X_pred) 46 | export(MEM_MIDAS_X_pred_no_skew) 47 | export(MEM_MIDAS_loglik) 48 | export(MEM_MIDAS_loglik_no_skew) 49 | export(MEM_MIDAS_lr_pred) 50 | export(MEM_MIDAS_lr_pred_no_skew) 51 | export(MEM_MIDAS_pred) 52 | export(MEM_MIDAS_pred_no_skew) 53 | export(MEM_X_loglik) 54 | export(MEM_X_loglik_no_skew) 55 | export(MEM_X_pred) 56 | export(MEM_X_pred_no_skew) 57 | export(MEM_loglik) 58 | export(MEM_loglik_no_skew) 59 | export(MEM_pred) 60 | export(MEM_pred_no_skew) 61 | export(beta_function) 62 | export(exp_almon) 63 | export(multi_step_ahead_pred) 64 | export(mv_into_mat) 65 | export(print.rumidas) 66 | export(summary.rumidas) 67 | export(ugmfit) 68 | export(umemfit) 69 | import(lubridate) 70 | import(maxLik) 71 | import(roll) 72 | import(tseries) 73 | import(xts) 74 | import(zoo) 75 | importFrom(Rdpack,reprompt) 76 | importFrom(stats,arima) 77 | importFrom(stats,coef) 78 | importFrom(stats,time) 79 | importFrom(utils,capture.output) 80 | importFrom(xts,apply.monthly) 81 | importFrom(xts,apply.quarterly) 82 | importFrom(xts,apply.weekly) 83 | importFrom(xts,apply.yearly) 84 | importFrom(zoo,coredata) 85 | -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | # rumidas 0.1.3 2 | 3 | * Fixed bugs. 4 | * Introduced the GM with two low-frequency variables ("GM2M"). 5 | 6 | # rumidas 0.1.2 7 | 8 | * Fixed bugs. 9 | * Introduced random starting values for GARCH-MIDAS and MEM-MIDAS models. 10 | * Introduced the DAGM with two low-frequency variables ("DAGM2M"). 11 | 12 | # rumidas 0.1.1 13 | 14 | * Added Exponential Almon lag function to weight the lagged realizations of the MIDAS variable for the GARCH-MIDAS models. 15 | * Introduced the models GMX, DAGMX, MEMX, and MEMMIDASX, that is: GARCH-MIDAS-X, DAGM-X, MEM-X and MEM-MIDAS-X. 16 | * Introduced the multi-step-ahead predictions for the GARCH-MIDAS models. 17 | * Fixed typos. 18 | * Improved function print.rumidas. 19 | 20 | # rumidas 0.1.0 21 | 22 | * First release 23 | -------------------------------------------------------------------------------- /R/data.R: -------------------------------------------------------------------------------- 1 | #' S&P 500 daily log-returns 2 | #' 3 | #' Daily data on S&P 500 collected from the realized library of 4 | #' the Oxford-Man Institute \insertCite{heber_2009}{rumidas}. 5 | #' 6 | #' @docType data 7 | #' 8 | #' @usage data(sp500) 9 | #' 10 | #' @format An object of class \code{"xts"}. 11 | #' 12 | #' @keywords datasets 13 | #' 14 | #' @importFrom Rdpack reprompt 15 | #' @import xts 16 | #' @import tseries 17 | #' @references 18 | #' \insertAllCited{} 19 | #' 20 | #' @source Realized library of the Oxford-Man Institute 21 | #' 22 | #' @examples 23 | #' head(sp500) 24 | #' summary(sp500) 25 | #' plot(sp500) 26 | "sp500" 27 | 28 | #' S&P 500 realized variance at 5-minutes 29 | #' 30 | #' Daily data on the realized variance of the S&P 500 collected from the realized library of 31 | #' the Oxford-Man Institute \insertCite{heber_2009}{rumidas}. The realized variance has been calculated 32 | #' using intradaily intervals of five minutes \insertCite{andersen_boll_1998}{rumidas}. 33 | #' 34 | #' @docType data 35 | #' 36 | #' @usage data(rv5) 37 | #' 38 | #' @format An object of class \code{"xts"}. 39 | #' 40 | #' @keywords datasets 41 | #' 42 | #' @importFrom Rdpack reprompt 43 | #' @import xts 44 | #' @import tseries 45 | #' @references 46 | #' \insertAllCited{} 47 | #' 48 | #' @source Realized library of the Oxford-Man Institute 49 | #' 50 | #' @examples 51 | #' head(rv5) 52 | #' summary(rv5) 53 | #' plot(rv5) 54 | "rv5" 55 | 56 | #' Monthly U.S. Industrial Production 57 | #' 58 | #' Monthly data on the U.S. Industrial Production index (IP, index 2012=100, seasonally adjusted) collected from the 59 | #' Federal Reserve Economic Data (FRED) archive. The IP has been used as MIDAS term in different contributions 60 | #' (see, for instance, \insertCite{engle_ghysels_sohn_2013;textual}{rumidas}, \insertCite{conrad_lock_2015;textual}{rumidas}, and 61 | #' \insertCite{amendola_candila_scognamillo_2017;textual}{rumidas}). 62 | #' 63 | #' @docType data 64 | #' 65 | #' @usage data(indpro) 66 | #' 67 | #' @format An object of class \code{"xts"}. 68 | #' 69 | #' @keywords datasets 70 | #' 71 | #' @importFrom Rdpack reprompt 72 | #' @import xts 73 | #' @import tseries 74 | #' @references 75 | #' \insertAllCited{} 76 | #' 77 | #' @source Archive of the Federal Reserve Economic Data \href{https://fred.stlouisfed.org/series/INDPRO}{(FRED)} 78 | #' 79 | #' @examples 80 | #' head(indpro) 81 | #' summary(indpro) 82 | #' plot(indpro) 83 | "indpro" 84 | 85 | #' VIX daily data 86 | #' 87 | #' Daily data on VIX collected from Yahoo Finance site. The VIX data 88 | #' have been de-annualized and multiplied by \eqn{100^{-1}}. 89 | #' 90 | #' @docType data 91 | #' 92 | #' @usage data(vix) 93 | #' 94 | #' @format An object of class \code{"xts"}. 95 | #' 96 | #' @keywords datasets 97 | #' 98 | #' @importFrom Rdpack reprompt 99 | #' @import xts 100 | #' @import tseries 101 | #' 102 | #' @source \href{https://finance.yahoo.com/}{Yahoo Finance} 103 | #' 104 | #' @examples 105 | #' head(vix) 106 | #' summary(vix) 107 | #' plot(vix) 108 | "vix" 109 | 110 | 111 | -------------------------------------------------------------------------------- /R/functions.R: -------------------------------------------------------------------------------- 1 | #' Beta function 2 | #' 3 | #' Represents a tool able to accommodate various lag structures for the 4 | #' additional MIDAS variable observed each "low-frequency" period \eqn{t}. It can have a monotonically increasing, 5 | #' decreasing weighting scheme or a hump-shaped weighting scheme. The Beta function is: 6 | #' \deqn{\delta_k(\omega)=\frac{(k/K)^{\omega_1-1} (1-k/K)^{\omega_2-1}}{\sum_{j=1}^K (j/K)^{\omega_1-1}(1-j/K)^{\omega_2-1}}.} 7 | #' For additional details, see \insertCite{ghysels_2007;textual}{rumidas}. 8 | #' @param k Lag of interest. 9 | #' @param K Number of (lagged) realizations to consider. 10 | #' @param w1,w2 Parameters governing the weights of each \eqn{k} lag. 11 | #' @return The weights associated to each lag \eqn{k}, with \eqn{k=1,\cdots,K}. 12 | #' @importFrom Rdpack reprompt 13 | #' @references 14 | #' \insertAllCited{} 15 | #' @examples 16 | #' # suppose to have four lags: 17 | #' # K<-4 18 | #' # w1<-1 # by setting w1=1, only a monotonically decreasing weighting scheme is allowed 19 | #' #(more recent observations weigh more) 20 | #' # w2<-5 21 | #' beta_function(1:4,K=4,w1=1,w2=5) 22 | #' @export 23 | 24 | ## Beta function 25 | 26 | beta_function<-function(k,K,w1,w2){ 27 | j<-1:K 28 | num<-((k/K)^(w1-1))*(1-k/K)^(w2-1) 29 | den<-sum( 30 | ((j/K)^(w1-1))*(1-j/K)^(w2-1) 31 | ) 32 | beta_func<-num/den 33 | return(beta_func) 34 | } 35 | 36 | #' Exponential Almon Lag 37 | #' 38 | #' Represents a tool able to accommodate various lag structures for the 39 | #' additional MIDAS variable observed each "low-frequency" period \eqn{t}. It can have a monotonically increasing, 40 | #' decreasing weighting scheme or a hump-shaped weighting scheme. As in \insertCite{ghysels_2007;textual}{rumidas}, 41 | #' here the function form uses only two parameters: 42 | #' \deqn{\delta_k(\omega_1, \omega_2) = \frac{exp(\omega_{1}k + \omega_2 k^2)}{\sum_{k=1}^K exp(\omega_1 k + \omega_2 k^2)}.} 43 | #' For additional details, see \insertCite{almon_1965;textual}{rumidas} and \insertCite{ghysels_2007;textual}{rumidas}. 44 | #' @param k Lag of interest. 45 | #' @param K Number of (lagged) realizations to consider. 46 | #' @param w1,w2 Parameters governing the weights of each \eqn{k} lag. 47 | #' @return The weights associated to each lag \eqn{k}, with \eqn{k=1,\cdots,K}. 48 | #' @importFrom Rdpack reprompt 49 | #' @references 50 | #' \insertAllCited{} 51 | #' @examples 52 | #' # suppose to have four lags: 53 | #' # K<-4 # Note: the number of lags to consider 54 | #' # w1<-1 55 | #' # w2<- -0.5 # by setting w2<0, the monotonically decreasing weighting scheme is used 56 | #' exp_almon(1:4,K=4,w1=0.1,w2=-0.5) 57 | #' @export 58 | 59 | ## Exponential Almon lag function 60 | 61 | exp_almon<-function(k,K,w1,w2){ 62 | j<-1:K 63 | num <- exp(w1*k + w2*k^2) 64 | den <- sum( exp(w1*j + w2*j^2) ) 65 | exp_func <- num/den 66 | return(exp_func) 67 | } 68 | 69 | #' MIDAS variable matrix transformation 70 | #' 71 | #' Implements the transformation of the MIDAS variable into a matrix, whose dimension is 72 | #' \eqn{(K+1) \times N}, where \eqn{K} is the number of lagged realizations to consider and 73 | #' \eqn{N} is the length of the variable \eqn{x}. 74 | #' @param x Variable according to which the MIDAS term has to be aligned. It must be an 'xts' object. 75 | #' @param mv MIDAS variable, observed each period \eqn{t}. It must be an 'xts' object. 76 | #' @param K Number of (lagged) realizations of the MIDAS variable to consider. 77 | #' @param type The frequency of the period of observations for the MIDAS variable. It can be 'weekly', 'monthly', 'quarterly' or 'yearly'. 78 | #' @return The resulting matrix has as many rows as the number of lagged realizations (plus one) of the MIDAS variable 79 | #' to consider, and as many columns as the length of \eqn{x}. 80 | #' @importFrom Rdpack reprompt 81 | #' @importFrom xts apply.weekly 82 | #' @importFrom xts apply.monthly 83 | #' @importFrom xts apply.quarterly 84 | #' @importFrom xts apply.yearly 85 | #' @import roll 86 | #' @import xts 87 | #' @import tseries 88 | #' @import lubridate 89 | #' @import zoo 90 | #' @examples 91 | #' \donttest{ 92 | #' require(xts) 93 | #' # weekly frequency 94 | #' # obtain weekly MIDAS variable after daily aggregation 95 | #' RV_weekly_sum<-apply.weekly(rv5^0.5,sum) #realized volatility 96 | #' # then allocate correctly the information 97 | #' RV_weekly<-as.xts(coredata(RV_weekly_sum),seq(as.Date("2000-01-10"), 98 | #' by = "week", length.out = length(RV_weekly_sum))) 99 | #' # use mv_into_mat 100 | #' mv_into_mat(sp500['2002/2003-12-26'],diff(RV_weekly['/2003-12']),K=4,type="weekly") 101 | #' 102 | #' # monthly frequency 103 | #' r_t<-sp500['2005/2010'] 104 | #' mv_into_mat(r_t,diff(indpro),K=12,type="monthly") 105 | #' 106 | #' # quarterly frequency 107 | #' RV_quarterly_sum<-apply.quarterly(rv5,sum) 108 | #' RV_quarterly<-as.xts(coredata(RV_quarterly_sum),seq(as.Date("2000-04-01"), 109 | #' by = "quarter", length.out = length(RV_quarterly_sum))) 110 | #' mv_into_mat(sp500['2004/2010'],diff(RV_quarterly),K=10,type="quarterly") 111 | #' 112 | #' # yearly frequency 113 | #' RV_yearly_sum<-apply.yearly(rv5,sum) 114 | #' RV_yearly<-as.xts(coredata(RV_yearly_sum),seq(as.Date("2001-01-01"), 115 | #' by = "year", length.out = length(RV_yearly_sum))) 116 | #' mv_into_mat(sp500['2006/2010'],diff(RV_yearly),K=2,type="yearly") 117 | #' } 118 | #' @export 119 | 120 | mv_into_mat<-function(x,mv,K,type){ 121 | 122 | N<-length(x) 123 | N_mv<-length(mv) 124 | 125 | cond_r_t<- class(x)[1] 126 | cond_mv<- class(mv)[1] 127 | 128 | first_obs_r_t<- (first(index(x))) 129 | first_obs_mv<- (first(index(mv))) 130 | diff_time<-as.numeric(difftime(first_obs_r_t,first_obs_mv,units="day")) 131 | num_obs_k<-ifelse(type=="weekly",5, 132 | ifelse(type=="monthly",30, 133 | ifelse(type=="quarterly",120,365))) 134 | 135 | 136 | w_days_r_t<- lubridate::wday(index(last(x))) 137 | 138 | 139 | last_mv<-paste(xts::last(lubridate::year(mv)),xts::last(lubridate::month(mv)),"20",sep="-") 140 | last_r_t<-paste(xts::last(lubridate::year(x)),xts::last(lubridate::month(x)),"20",sep="-") 141 | 142 | 143 | 144 | ############# checks 145 | 146 | if(cond_r_t != "xts") { stop("x must be an xts object. Please provide it in the correct form")} 147 | if(cond_mv != "xts") { stop("mv must be an xts object. Please provide it in the correct form")} 148 | 149 | 150 | if(diff_time<0|((diff_time - K*num_obs_k)<0)) { stop("mv must start at least 151 | 'K+1' periods before x. Please decrease K or provide more observations (in the past) for mv")} 152 | 153 | 154 | if(last_mv != last_r_t & type=="weekly") { stop("x and mv must end in the same period")} 155 | if(w_days_r_t != 6 & type=="weekly") { stop("the last day of x must be friday")} 156 | 157 | 158 | mv_m<-matrix(c(rep(NA,(K+1)*N)),ncol=N) 159 | 160 | 161 | if(type=="weekly"){ 162 | for(i in 1:N){ 163 | start_p_mv1 <- which(format(index(mv),"%Y-%m-%d")== 164 | format( 165 | lubridate::floor_date(index(x), "week",week_start = 1)[i],"%Y-%m-%d")) 166 | mv_m[,i] <- mv[(start_p_mv1-K):(start_p_mv1+1)][2:(K+2)] 167 | } 168 | 169 | } else if (type=="monthly") { 170 | for(i in 1:N){ 171 | start_p_mv1 <- which(format(index(mv),"%Y-%m")==format(index(x)[i],"%Y-%m")) 172 | mv_m[,i] <- mv[(start_p_mv1-K):(start_p_mv1)] 173 | } 174 | } else if (type=="quarterly"){ 175 | for(i in 1:N){ 176 | start_p_mv1 <- which(format(index(mv),"%Y-%m-%d")== 177 | format( 178 | lubridate::floor_date(index(x), "quarter",week_start = 1)[i],"%Y-%m-%d")) 179 | mv_m[,i] <- mv[(start_p_mv1-K):(start_p_mv1+1)][2:(K+2)] 180 | message(i) 181 | } 182 | 183 | } else { 184 | for(i in 1:N){ 185 | start_p_mv1 <- which(format(index(mv),"%Y-%m-%d")== 186 | format( 187 | lubridate::floor_date(index(x), "year",week_start = 1)[i],"%Y-%m-%d")) 188 | mv_m[,i] <- c(zoo::coredata(mv[(start_p_mv1-K):(start_p_mv1)][2:(K+1)]),0) 189 | message(i) 190 | } 191 | 192 | } 193 | 194 | return(mv_m) 195 | } 196 | 197 | 198 | #' Information Criteria 199 | #' 200 | #' Returns the Akaike and Bayesian information criteria. 201 | #' @param est The output of the estimation process. 202 | #' @return The resulting vector represents the AIC and BIC criteria. 203 | #' @importFrom Rdpack reprompt 204 | #' @import maxLik 205 | #' @keywords internal 206 | 207 | Inf_criteria<-function(est){ 208 | 209 | inf<-round(c(AIC=(2*length(stats::coef(est))-2*stats::logLik(est)), 210 | BIC=length(stats::coef(est))*log(nrow(est$gradientObs))-2*stats::logLik(est)),6) 211 | 212 | } 213 | 214 | 215 | #' Loss functions 216 | #' 217 | #' Returns the MSE and QLIKE. 218 | #' @param vol_est It is the estimated volatility. 219 | #' @param vol_proxy It is the volatility proxy. 220 | #' @return The resulting vector represents the MSE and QLIKE averages. 221 | #' @importFrom Rdpack reprompt 222 | #' @keywords internal 223 | 224 | LF_f<-function(vol_est,vol_proxy){ 225 | 226 | LF_avg<-c( 227 | "MSE(%)"=100*mean( (vol_est-vol_proxy)^2), 228 | "QLIKE"=mean( log(vol_est) + (vol_proxy/vol_est) ) 229 | ) 230 | 231 | return(LF_avg) 232 | 233 | } 234 | 235 | #' Standard errors for the Quasi Maximum Likelihood estimator of the GARCH-MIDAS-based models 236 | #' 237 | #' Obtains the standard errors for the Quasi Maximum Likelihood (QML) estimator. 238 | #' @param est It is the output of the maximum likelihood estimation process. 239 | #' @return The resulting vector represents the QML standard errors. 240 | #' @importFrom Rdpack reprompt 241 | #' @import maxLik 242 | #' @keywords internal 243 | 244 | QMLE_sd<-function(est){ 245 | 246 | ############### QMLE standard errors (-H)^-1 OPG (-H)^-1 247 | 248 | H_hat_inv<- solve(-hessian(est)) 249 | OPG<-t(est$gradientObs)%*%est$gradientObs 250 | 251 | return(diag(H_hat_inv%*%OPG%*%H_hat_inv)^0.5) 252 | } 253 | 254 | 255 | #' Standard errors for the Quasi Maximum Likelihood estimator of the MEM-based models 256 | #' 257 | #' Obtains the standard errors for the Quasi Maximum Likelihood (QML) estimator. 258 | #' @param est It is the output of the maximum likelihood estimation process. 259 | #' @return The resulting vector represents the QML standard errors. 260 | #' @importFrom Rdpack reprompt 261 | #' @import maxLik 262 | #' @keywords internal 263 | 264 | MEM_QMLE_sd<-function(est,x,x_pred){ 265 | 266 | num_param<-ncol(est$gradientObs) 267 | 268 | eps<-x/x_pred 269 | var_eps<-stats::var(eps) 270 | 271 | sd_coef <- diag( 272 | matrix(rep(var_eps/2,num_param^2),ncol=num_param) * -solve(hessian(est)) 273 | )^0.5 # QMLE standard errors 274 | 275 | } 276 | 277 | #' Print method for 'rumidas' class 278 | #' 279 | #' @param x An object of class 'rumidas'. 280 | #' @param ... Further arguments passed to or from other methods. 281 | 282 | #' @keywords internal 283 | #' @export print.rumidas 284 | #' @export 285 | print.rumidas <- function(x, ...) { 286 | 287 | options(scipen = 999) 288 | 289 | model<-x[[1]] 290 | mat_coef<-x[[2]] 291 | 292 | coef_char<-as.character(round(mat_coef[,1],4)) 293 | 294 | row_names<-gsub("\\s", " ", format(rownames(mat_coef), width=9)) 295 | coef_val<-gsub("\\s", " ", format(coef_char,width=9)) 296 | 297 | cat( 298 | cat("\n"), 299 | cat(paste("Model:",model),"\n"), 300 | cat("\n"), 301 | cat(paste("Coefficients: \n",sep="\n")), 302 | cat(row_names, sep=" ", "\n"), 303 | cat(coef_val, sep=" ", "\n"), 304 | cat("\n")) 305 | } 306 | 307 | #' Summary method for 'rumidas' class 308 | #' 309 | #' @param object An object of class 'rumidas', that is the result of a call to \code{\link{ugmfit}} or \code{\link{umemfit}}. 310 | #' @param ... Additional arguments affecting the summary produced. 311 | #' @examples 312 | #' \donttest{ 313 | #' r_t<-sp500['2003/2010'] 314 | #' real<-(rv5['2003/2010'])^0.5 # realized volatility 315 | #' fit<-umemfit(model="MEM",skew="NO",x=real) 316 | #' summary.rumidas(fit) 317 | #' } 318 | #' @importFrom utils capture.output 319 | #' @export summary.rumidas 320 | #' @export 321 | summary.rumidas <- function(object, ...) { 322 | 323 | model<-object$model 324 | mat_coef<-object$rob_coef_mat 325 | Obs<-object$obs 326 | Period<-object$period 327 | loss<-object$loss_in_s 328 | 329 | 330 | Period<-paste(substr(Period[1], 1, 10),"/", 331 | substr(Period[2], 1, 10),sep="") 332 | 333 | p_value<-mat_coef[,4] 334 | 335 | sig<-ifelse(p_value<=0.01,"***",ifelse(p_value>0.01&p_value<=0.05,"**", 336 | ifelse(p_value>0.05&p_value<=0.1,"*"," "))) 337 | 338 | mat_coef<-round(mat_coef,4) 339 | 340 | mat_coef<-cbind(mat_coef,Sig.=sig) 341 | 342 | cat( 343 | cat("\n"), 344 | cat("Coefficients:\n"), 345 | cat(utils::capture.output(mat_coef), sep = '\n'), 346 | cat("--- \n"), 347 | cat("Signif. codes: 0.01 '***', 0.05 '**', 0.1 '*' \n"), 348 | cat("\n"), 349 | cat("Obs.:", paste(Obs, ".",sep=""), "Sample Period:", Period, "\n"), 350 | cat("MSE(%):", paste(as.numeric(round(loss[1],6)), "; ",sep=""), 351 | "QLIKE:", as.numeric(round(loss[2],6)), "\n"), 352 | cat("\n")) 353 | 354 | } 355 | 356 | #' Summation function for the multi-step-ahead predictions of the GARCH--MIDAS models with the '--X' part. 357 | #' 358 | #' For details, see Eq. (20) of \insertCite{amendola_candila_gallo_2020;textual}{rumidas}. 359 | #' @param COEF The sum of the parameters \eqn{alpha}, \eqn{\beta}, and \eqn{\gamma/2}, if present. 360 | #' @param DELTA The AR coefficient. 361 | #' @param H The length of the multi-step-ahead predictions. 362 | #' @return The vector of the summation for each H. 363 | #' @importFrom Rdpack reprompt 364 | #' @references 365 | #' \insertAllCited{} 366 | #' @import maxLik 367 | #' @keywords internal 368 | 369 | sum_X_f<-function(COEF,DELTA,H){ 370 | 371 | res<-list() 372 | for(j in 0:(H-2)){ 373 | res[[j+1]]<-COEF^j*DELTA^(H-j-1) 374 | } 375 | return(unlist(res)) 376 | } 377 | 378 | 379 | 380 | #' Multi--step--ahead predictions of the GARCH--MIDAS--based models with and without the '--X' part. 381 | #' 382 | #' Calculates the multi--step--ahead predictions for the GARCH--MIDAS and DAGM models, according to the procedure 383 | #' suggested by \insertCite{amendola_candila_gallo_2020;textual}{rumidas}. 384 | #' @param est The estimation object as resulting by the \code{\link{ugmfit}} function 385 | #' @param h The length of the multi-step-ahead predictions 386 | #' @param X **optional**. The '--X' variable. NULL by default. It hat to be equal to the 'X' used in the \code{\link{ugmfit}} function 387 | #' @return The multi-step-ahead predictions, for the following h days, starting from the last day of the 388 | #' chosen in-sample period adopted in the 'est' object. 389 | #' @importFrom stats coef 390 | #' @importFrom stats arima 391 | #' @references 392 | #' \insertAllCited{} 393 | #' @details 394 | #' The multi--step--ahead procedure calculates the volatility predictions keeping fixed the information set at the last 395 | #' observation available and projecting forward the forecasts. The procedure calculates the volatility predictions conditionally 396 | #' to the parameters estimated in the in-sample period. Therefore, the estimation object (through the \code{\link{ugmfit}} function) 397 | #' has to be provided. For additional details, see Eq. (20) in \insertCite{amendola_candila_gallo_2020;textual}{rumidas}. 398 | #' @examples 399 | #' \donttest{ 400 | #' r_t<-sp500['2008'] 401 | #' X<-(rv5['2008'])^0.5 402 | #' mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 403 | #' fit<-ugmfit(model="GMX",skew="YES",distribution="norm",r_t,mv_m,K=12,X=X) 404 | #' ### ten days predictions 405 | #' multi_step_ahead_pred(fit,h=10,X) 406 | #' } 407 | #' @importFrom Rdpack reprompt 408 | #' @import maxLik 409 | #' @export 410 | 411 | multi_step_ahead_pred<-function(est,h,X=NULL){ 412 | 413 | ### check 414 | 415 | if((est$model=="GMX"|est$model=="DAGMX")&(missing(X))) { stop(cat("#Warning:\n If the estimated model includes the 'X' term, then the 'X' variable has to be provided \n"))} 416 | 417 | ### verify if the object 'est' has the out-of-sample option 418 | 419 | out_of_sample<-NULL 420 | out_of_sample<-ifelse(is.null(est$est_vol_oos),0,length(est$est_vol_oos)) 421 | 422 | vol<-est$est_vol_in_s 423 | tau_t<-est$est_lr_in_s 424 | g_it<-vol/tau_t 425 | 426 | g_1_t_plus_1<-xts::last(g_it) 427 | tau_t_plus_1<-xts::last(tau_t) 428 | 429 | coef_est<-cbind(est$rob_coef_mat[,1]) 430 | rownames(coef_est)<-rownames(est$rob_coef_mat) 431 | 432 | alpha_hat<-coef_est[which(rownames(coef_est)=="alpha")] 433 | beta_hat<-coef_est[which(rownames(coef_est)=="beta")] 434 | 435 | gamma_hat<-coef_est[which(rownames(coef_est)=="gamma")] 436 | gamma_hat<-ifelse(identical(gamma_hat, numeric(0)),0,gamma_hat) 437 | 438 | coef_sum<-alpha_hat+gamma_hat/2+beta_hat 439 | 440 | pred<-rep(NA,h) 441 | 442 | pred[1]<-(g_1_t_plus_1)*tau_t_plus_1 443 | 444 | 445 | if (est$model=="GMX"|est$model=="DAGMX"){ 446 | 447 | z_hat<-coef_est[which(rownames(coef_est)=="z")] 448 | 449 | N<-length(vol)+out_of_sample 450 | 451 | X_in_s<-X[1:(N-out_of_sample)] 452 | 453 | x_last<-xts::last(X_in_s) 454 | x_last<-zoo::coredata(x_last) 455 | z_x_last<-z_hat*x_last 456 | delta<-stats::coef(stats::arima(X_in_s,order=c(1,0,0),include.mean=T))[1] 457 | 458 | 459 | suppressWarnings( 460 | for(i in 2:h){ 461 | pred[i]<-(1+coef_sum^(i-1)*(g_1_t_plus_1-1)+ 462 | sum(sum_X_f(coef_sum,delta,i)*z_x_last))*tau_t_plus_1 463 | } 464 | ) 465 | } else { 466 | 467 | for(i in 2:h){ 468 | pred[i]<-(1+coef_sum^(i-1)*(g_1_t_plus_1-1))*tau_t_plus_1 469 | } 470 | 471 | } 472 | 473 | return(pred) 474 | } 475 | 476 | 477 | 478 | -------------------------------------------------------------------------------- /build/partial.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/rumidas/30ae373ce70b14464f0c4eb95e6d723599d24ce9/build/partial.rdb -------------------------------------------------------------------------------- /data/indpro.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/rumidas/30ae373ce70b14464f0c4eb95e6d723599d24ce9/data/indpro.rda -------------------------------------------------------------------------------- /data/rv5.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/rumidas/30ae373ce70b14464f0c4eb95e6d723599d24ce9/data/rv5.rda -------------------------------------------------------------------------------- /data/sp500.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/rumidas/30ae373ce70b14464f0c4eb95e6d723599d24ce9/data/sp500.rda -------------------------------------------------------------------------------- /data/vix.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/rumidas/30ae373ce70b14464f0c4eb95e6d723599d24ce9/data/vix.rda -------------------------------------------------------------------------------- /inst/CITATION: -------------------------------------------------------------------------------- 1 | citHeader("When using rumidas in publications, please cite:") 2 | 3 | ## R >= 2.8.0 passes package metadata to citation(). 4 | if(!exists("meta") || is.null(meta)) meta <- packageDescription("rumidas") 5 | 6 | year <- 2025 7 | note <- sprintf("R package version %s.", meta$Version) 8 | 9 | bibentry(bibtype="Manual", 10 | title = "rumidas: Univariate GARCH-MIDAS, Double-Asymmetric GARCH-MIDAS and MEM-MIDAS models.", 11 | author = c("Vincenzo Candila"), 12 | year = year, 13 | note = note, 14 | textVersion = 15 | paste("Vincenzo Candila", 16 | sprintf("(%s).", year), 17 | "rumidas: Univariate GARCH-MIDAS, Double-Asymmetric GARCH-MIDAS and MEM-MIDAS models.", 18 | note), 19 | header = "To cite the rumidas package, please use:" 20 | ) -------------------------------------------------------------------------------- /inst/REFERENCES.bib: -------------------------------------------------------------------------------- 1 | 2 | @Article{ghysels_2007, 3 | author = {Ghysels, Eric and Sinko, Arthur and Valkanov, Rossen}, 4 | journal = {Econometric Reviews}, 5 | title = {{MIDAS} regressions: Further results and new directions}, 6 | year = {2007}, 7 | number = {1}, 8 | pages = {53--90}, 9 | volume = {26}, 10 | doi = {10.1080/07474930600972467} 11 | } 12 | 13 | @TechReport{heber_2009, 14 | author = {Heber, G. and Lunde, A. and Shephard, N. and Sheppard, K.}, 15 | title = {OMI's realised library, version 0.1}, 16 | institution = {Oxford--Man Institute, University of Oxford}, 17 | year = {2009}, 18 | } 19 | 20 | @article{almon_1965, 21 | title={The distributed lag between capital appropriations and expenditures}, 22 | author={Almon, Shirley}, 23 | journal={Econometrica: Journal of the Econometric Society}, 24 | pages={178--196}, 25 | year={1965}, 26 | publisher={JSTOR}, 27 | doi={10.2307/1911894} 28 | } 29 | 30 | 31 | @Article{andersen_boll_1998, 32 | Title = {Answering the Skeptics: Yes, Standard Volatility Models do Provide Accurate Forecasts}, 33 | Author = {Andersen, Torben G. and Bollerslev, Tim}, 34 | Year = {1998}, 35 | Pages = {885--905}, 36 | Volume = {39}, 37 | Journal = {International Economic Review}, 38 | doi = {10.2307/2527343} 39 | } 40 | 41 | @Article{conrad_lock_2015, 42 | author = {Conrad, Christian and Loch, Karin}, 43 | journal = {Journal of Applied Econometrics}, 44 | title = {Anticipating Long-Term Stock Market Volatility}, 45 | year = {2015}, 46 | number = {7}, 47 | pages = {1090--1114}, 48 | volume = {30}, 49 | publisher = {Wiley Online Library}, 50 | doi = {10.1002/jae.2404} 51 | } 52 | 53 | @Article{amendola_candila_scognamillo_2017, 54 | author = {Amendola, Alessandra and Candila, Vincenzo and Scognamillo, Antonio}, 55 | journal = {Empirical Economics}, 56 | title = {On the influence of {US} monetary policy on crude oil price volatility}, 57 | year = {2017}, 58 | number = {1}, 59 | pages = {155--178}, 60 | volume = {52}, 61 | doi = {10.1007/s00181-016-1069-5} 62 | } 63 | 64 | @Article{engle_ghysels_sohn_2013, 65 | author = {Engle, Robert F and Ghysels, Eric and Sohn, Bumjean}, 66 | journal = {Review of Economics and Statistics}, 67 | title = {Stock market volatility and macroeconomic fundamentals}, 68 | year = {2013}, 69 | number = {3}, 70 | pages = {776--797}, 71 | volume = {95}, 72 | publisher = {MIT Press}, 73 | doi = {10.1162/REST_a_00300} 74 | } 75 | 76 | @Article{dcc_engle_2002, 77 | title={Dynamic conditional correlation: A simple class of multivariate generalized autoregressive conditional heteroskedasticity models}, 78 | author={Engle, Robert}, 79 | journal={Journal of Business \& Economic Statistics}, 80 | volume={20}, 81 | number={3}, 82 | pages={339--350}, 83 | year={2002}, 84 | publisher={Taylor \& Francis} 85 | } 86 | 87 | @Article{colacito2011component, 88 | title={A component model for dynamic correlations}, 89 | author={Colacito, Riccardo and Engle, Robert F and Ghysels, Eric}, 90 | journal={Journal of Econometrics}, 91 | volume={164}, 92 | number={1}, 93 | pages={45--59}, 94 | year={2011}, 95 | publisher={Elsevier} 96 | } 97 | 98 | @Article{Bollerslev_Wooldridge_1992, 99 | author = {Bollerslev, Tim and Wooldridge, Jeffrey M.}, 100 | journal = {Econometric Reviews}, 101 | title = {Quasi-maximum likelihood estimation and inference in dynamic models with time-varying covariances}, 102 | year = {1992}, 103 | pages = {143--172}, 104 | volume = {11}, 105 | doi = {10.1080/07474939208800229} 106 | } 107 | 108 | @article{amendola_candila_gallo:2019, 109 | title={On the asymmetric impact of macro--variables on volatility}, 110 | author={Amendola, Alessandra and Candila, Vincenzo and Gallo, Giampiero M.}, 111 | journal={Economic Modelling}, 112 | volume={76}, 113 | pages={135--152}, 114 | year={2019}, 115 | publisher={Elsevier}, 116 | doi = {10.1016/j.econmod.2018.07.025} 117 | } 118 | 119 | 120 | @Article{henningsen_toomet_2011, 121 | title = {maxLik: A package for maximum likelihood estimation in {R}}, 122 | author = {Arne Henningsen and Ott Toomet}, 123 | journal = {Computational Statistics}, 124 | year = {2011}, 125 | volume = {26}, 126 | number = {3}, 127 | pages = {443--458}, 128 | doi = {10.1007/s00180-010-0217-1} 129 | } 130 | 131 | 132 | @article{amendola2024doubly, 133 | author = {Amendola, Alessandra and Candila, Vincenzo and Cipollini, Fabrizio and Gallo, Giampiero M.}, 134 | title={Doubly multiplicative error models with long-and short-run components}, 135 | journal={Socio-Economic Planning Sciences}, 136 | volume={91}, 137 | pages={101764}, 138 | year={2024}, 139 | publisher={Elsevier}, 140 | doi={10.1016/j.seps.2023.101764} 141 | } 142 | 143 | @Article{engle_gallo_2006, 144 | Title = {A Multiple Indicators Model for Volatility Using Intra-Daily Data}, 145 | Author = {Engle, Robert F. and Gallo, Giampiero M.}, 146 | Year = {2006}, 147 | Pages = {3--27}, 148 | Volume = {131}, 149 | Journal = {Journal of Econometrics}, 150 | doi = {10.1016/j.jeconom.2005.01.018} 151 | } 152 | 153 | @article{amendola_candila_gallo_2020, 154 | title={Choosing the frequency of volatility components within the Double Asymmetric GARCH--MIDAS--X model}, 155 | author={Amendola, Alessandra and Candila, Vincenzo and Gallo, Giampiero M.}, 156 | journal={Economic and Statistics}, 157 | year={2021}, 158 | doi={10.1016/j.ecosta.2020.11.001} 159 | } 160 | 161 | 162 | -------------------------------------------------------------------------------- /man/DAGM_2M_cond_vol.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{DAGM_2M_cond_vol} 4 | \alias{DAGM_2M_cond_vol} 5 | \title{DAGM-2M conditional volatility (with skewness)} 6 | \usage{ 7 | DAGM_2M_cond_vol(param, daily_ret, mv_m_1, mv_m_2, K_1, K_2, lag_fun = "Beta") 8 | } 9 | \arguments{ 10 | \item{param}{Vector of starting values.} 11 | 12 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 13 | 14 | \item{mv_m_1}{first MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 15 | 16 | \item{mv_m_2}{second MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 17 | 18 | \item{K_1}{Number of (lagged) realizations of the first MIDAS variable to consider.} 19 | 20 | \item{K_2}{Number of (lagged) realizations of the second MIDAS variable to consider.} 21 | 22 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 23 | for the Beta and Exponential Almon lag functions, respectively.} 24 | } 25 | \value{ 26 | The resulting vector is an "xts" object representing the conditional volatility. 27 | } 28 | \description{ 29 | Obtains the conditional volatility of the DAGM with two MIDAS variables. 30 | For details, see \insertCite{amendola_candila_gallo:2019;textual}{rumidas}. 31 | } 32 | \examples{ 33 | \donttest{ 34 | start_val<-c(0.01,0.80,0.05,0.2,0.1,1.1,0.4,1.1,0.5,1.1,0,1.1) 35 | r_t<-sp500['2005/2010'] 36 | mv_m_1<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 37 | mv_m_2<-mv_into_mat(r_t,diff(indpro),K=24,"monthly") 38 | head(DAGM_2M_cond_vol(start_val,r_t,mv_m_1,mv_m_2,K_1=12,K_2=24)) 39 | } 40 | } 41 | \references{ 42 | \insertAllCited{} 43 | } 44 | \seealso{ 45 | \code{\link{mv_into_mat}}. 46 | } 47 | \keyword{internal} 48 | -------------------------------------------------------------------------------- /man/DAGM_2M_cond_vol_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{DAGM_2M_cond_vol_no_skew} 4 | \alias{DAGM_2M_cond_vol_no_skew} 5 | \title{DAGM-2M conditional volatility (no skewness)} 6 | \usage{ 7 | DAGM_2M_cond_vol_no_skew( 8 | param, 9 | daily_ret, 10 | mv_m_1, 11 | mv_m_2, 12 | K_1, 13 | K_2, 14 | lag_fun = "Beta" 15 | ) 16 | } 17 | \arguments{ 18 | \item{param}{Vector of starting values.} 19 | 20 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 21 | 22 | \item{mv_m_1}{first MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 23 | 24 | \item{mv_m_2}{second MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 25 | 26 | \item{K_1}{Number of (lagged) realizations of the first MIDAS variable to consider.} 27 | 28 | \item{K_2}{Number of (lagged) realizations of the second MIDAS variable to consider.} 29 | 30 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 31 | for the Beta and Exponential Almon lag functions, respectively.} 32 | } 33 | \value{ 34 | The resulting vector is an "xts" object representing the conditional volatility. 35 | } 36 | \description{ 37 | Obtains the conditional volatility of the DAGM with two MIDAS variables. 38 | For details, see \insertCite{amendola_candila_gallo:2019;textual}{rumidas}. 39 | } 40 | \examples{ 41 | \donttest{ 42 | start_val<-c(0.01,0.80,0.2,0.1,1.1,0.4,1.1,0.5,1.1,0,1.1) 43 | r_t<-sp500['2005/2010'] 44 | mv_m_1<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 45 | mv_m_2<-mv_into_mat(r_t,diff(indpro),K=24,"monthly") 46 | head(DAGM_2M_cond_vol_no_skew(start_val,r_t,mv_m_1,mv_m_2,K_1=12,K_2=24)) 47 | } 48 | } 49 | \references{ 50 | \insertAllCited{} 51 | } 52 | \seealso{ 53 | \code{\link{mv_into_mat}}. 54 | } 55 | \keyword{internal} 56 | -------------------------------------------------------------------------------- /man/DAGM_2M_loglik.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{DAGM_2M_loglik} 4 | \alias{DAGM_2M_loglik} 5 | \title{DAGM-2M log-likelihood (with skewness)} 6 | \usage{ 7 | DAGM_2M_loglik( 8 | param, 9 | daily_ret, 10 | mv_m_1, 11 | mv_m_2, 12 | K_1, 13 | K_2, 14 | distribution, 15 | lag_fun = "Beta" 16 | ) 17 | } 18 | \arguments{ 19 | \item{param}{Vector of starting values.} 20 | 21 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 22 | 23 | \item{mv_m_1}{first MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 24 | 25 | \item{mv_m_2}{second MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 26 | 27 | \item{K_1}{Number of (lagged) realizations of the first MIDAS variable to consider.} 28 | 29 | \item{K_2}{Number of (lagged) realizations of the second MIDAS variable to consider.} 30 | 31 | \item{distribution}{The conditional density to use for the innovations. At the moment, valid choices are "norm" and "std", for the Normal 32 | and Student-t distributions.} 33 | 34 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 35 | for the Beta and Exponential Almon lag functions, respectively.} 36 | } 37 | \value{ 38 | The resulting vector is the log-likelihood value for each \eqn{i,t}. 39 | } 40 | \description{ 41 | Obtains the log-likelihood of the DAGM with two MIDAS variables, with an asymmetric term linked to past negative returns, 42 | according to two errors' conditional distributions: Normal and Student-t. 43 | For details, see \insertCite{amendola_candila_gallo:2019;textual}{rumidas}. 44 | } 45 | \examples{ 46 | \donttest{ 47 | # conditional density of the innovations: normal 48 | start_val<-c(0.01,0.80,0.05,0.2,0.1,1.1,0.4,1.1,0.5,1.1,0,1.1) 49 | r_t<-sp500['2005/2010'] 50 | mv_m_1<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 51 | mv_m_2<-mv_into_mat(r_t,diff(indpro),K=24,"monthly") 52 | sum(DAGM_2M_loglik(start_val,r_t,mv_m_1,mv_m_2,K_1=12,K_2=24,distribution="norm")) 53 | } 54 | } 55 | \references{ 56 | \insertAllCited{} 57 | } 58 | \seealso{ 59 | \code{\link{mv_into_mat}}. 60 | } 61 | \keyword{internal} 62 | -------------------------------------------------------------------------------- /man/DAGM_2M_loglik_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{DAGM_2M_loglik_no_skew} 4 | \alias{DAGM_2M_loglik_no_skew} 5 | \title{DAGM-2M log-likelihood (without skewness)} 6 | \usage{ 7 | DAGM_2M_loglik_no_skew( 8 | param, 9 | daily_ret, 10 | mv_m_1, 11 | mv_m_2, 12 | K_1, 13 | K_2, 14 | distribution, 15 | lag_fun = "Beta" 16 | ) 17 | } 18 | \arguments{ 19 | \item{param}{Vector of starting values.} 20 | 21 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 22 | 23 | \item{mv_m_1}{first MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 24 | 25 | \item{mv_m_2}{second MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 26 | 27 | \item{K_1}{Number of (lagged) realizations of the first MIDAS variable to consider.} 28 | 29 | \item{K_2}{Number of (lagged) realizations of the second MIDAS variable to consider.} 30 | 31 | \item{distribution}{The conditional density to use for the innovations. At the moment, valid choices are "norm" and "std", for the Normal 32 | and Student-t distributions.} 33 | 34 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 35 | for the Beta and Exponential Almon lag functions, respectively.} 36 | } 37 | \value{ 38 | The resulting vector is the log-likelihood value for each \eqn{i,t}. 39 | } 40 | \description{ 41 | Obtains the log-likelihood of the DAGM with two MIDAS variables, 42 | according to two errors' conditional distributions: Normal and Student-t. 43 | For details, see \insertCite{amendola_candila_gallo:2019;textual}{rumidas}. 44 | } 45 | \examples{ 46 | \donttest{ 47 | # conditional density of the innovations: normal 48 | start_val<-c(0.01,0.80,0.2,0.1,1.1,0.4,1.1,0.5,1.1,0,1.1) 49 | r_t<-sp500['2005/2010'] 50 | mv_m_1<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 51 | mv_m_2<-mv_into_mat(r_t,diff(indpro),K=24,"monthly") 52 | sum(DAGM_2M_loglik_no_skew(start_val,r_t,mv_m_1,mv_m_2,K_1=12,K_2=24,distribution="norm")) 53 | } 54 | } 55 | \references{ 56 | \insertAllCited{} 57 | } 58 | \seealso{ 59 | \code{\link{mv_into_mat}}. 60 | } 61 | \keyword{internal} 62 | -------------------------------------------------------------------------------- /man/DAGM_2M_long_run.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{DAGM_2M_long_run} 4 | \alias{DAGM_2M_long_run} 5 | \title{DAGM-2M (daily) long-run volatility (with skewness)} 6 | \usage{ 7 | DAGM_2M_long_run(param, daily_ret, mv_m_1, mv_m_2, K_1, K_2, lag_fun = "Beta") 8 | } 9 | \arguments{ 10 | \item{param}{Vector of starting values.} 11 | 12 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 13 | 14 | \item{mv_m_1}{first MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 15 | 16 | \item{mv_m_2}{second MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 17 | 18 | \item{K_1}{Number of (lagged) realizations of the first MIDAS variable to consider.} 19 | 20 | \item{K_2}{Number of (lagged) realizations of the second MIDAS variable to consider.} 21 | 22 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 23 | for the Beta and Exponential Almon lag functions, respectively.} 24 | } 25 | \value{ 26 | The resulting vector is an "xts" object representing the long-run volatility. 27 | } 28 | \description{ 29 | Obtains the long-run volatility of the DAGM with two MIDAS variables. 30 | For details, see \insertCite{amendola_candila_gallo:2019;textual}{rumidas}. 31 | } 32 | \examples{ 33 | \donttest{ 34 | start_val<-c(0.01,0.80,0.05,0.2,0.1,1.1,0.4,1.1,0.5,1.1,0,1.1) 35 | r_t<-sp500['2005/2010'] 36 | mv_m_1<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 37 | mv_m_2<-mv_into_mat(r_t,diff(indpro),K=24,"monthly") 38 | head(DAGM_2M_long_run(start_val,r_t,mv_m_1,mv_m_2,K_1=12,K_2=24)) 39 | } 40 | } 41 | \references{ 42 | \insertAllCited{} 43 | } 44 | \seealso{ 45 | \code{\link{mv_into_mat}}. 46 | } 47 | \keyword{internal} 48 | -------------------------------------------------------------------------------- /man/DAGM_2M_long_run_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{DAGM_2M_long_run_no_skew} 4 | \alias{DAGM_2M_long_run_no_skew} 5 | \title{DAGM-2M (daily) long-run volatility (no skewness)} 6 | \usage{ 7 | DAGM_2M_long_run_no_skew( 8 | param, 9 | daily_ret, 10 | mv_m_1, 11 | mv_m_2, 12 | K_1, 13 | K_2, 14 | lag_fun = "Beta" 15 | ) 16 | } 17 | \arguments{ 18 | \item{param}{Vector of starting values.} 19 | 20 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 21 | 22 | \item{mv_m_1}{first MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 23 | 24 | \item{mv_m_2}{second MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 25 | 26 | \item{K_1}{Number of (lagged) realizations of the first MIDAS variable to consider.} 27 | 28 | \item{K_2}{Number of (lagged) realizations of the second MIDAS variable to consider.} 29 | 30 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 31 | for the Beta and Exponential Almon lag functions, respectively.} 32 | } 33 | \value{ 34 | The resulting vector is an "xts" object representing the long-run volatility. 35 | } 36 | \description{ 37 | Obtains the long-run volatility of the DAGM with two MIDAS variables. 38 | For details, see \insertCite{amendola_candila_gallo:2019;textual}{rumidas}. 39 | } 40 | \examples{ 41 | \donttest{ 42 | start_val<-c(0.01,0.80,0.2,0.1,1.1,0.4,1.1,0.5,1.1,0,1.1) 43 | r_t<-sp500['2005/2010'] 44 | mv_m_1<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 45 | mv_m_2<-mv_into_mat(r_t,diff(indpro),K=24,"monthly") 46 | head(DAGM_2M_long_run_no_skew(start_val,r_t,mv_m_1,mv_m_2,K_1=12,K_2=24)) 47 | } 48 | } 49 | \references{ 50 | \insertAllCited{} 51 | } 52 | \seealso{ 53 | \code{\link{mv_into_mat}}. 54 | } 55 | \keyword{internal} 56 | -------------------------------------------------------------------------------- /man/DAGM_X_cond_vol.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{DAGM_X_cond_vol} 4 | \alias{DAGM_X_cond_vol} 5 | \title{DAGM-X conditional volatility (with skewness)} 6 | \usage{ 7 | DAGM_X_cond_vol(param, daily_ret, X, mv_m, K, lag_fun = "Beta") 8 | } 9 | \arguments{ 10 | \item{param}{Vector of estimated values.} 11 | 12 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 13 | 14 | \item{X}{Additional "X" variable, which must be an "xts" object. Morever, "X" must be observed for the same days of daily_ret.} 15 | 16 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 17 | 18 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 19 | 20 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 21 | for the Beta and Exponential Almon lag functions, respectively.} 22 | } 23 | \value{ 24 | The resulting vector is an "xts" object representing the conditional volatility. 25 | } 26 | \description{ 27 | Obtains the conditional volatility for the DAGM-X, with an asymmetric term linked to past negative returns. 28 | For details, see \insertCite{amendola_candila_gallo:2019;textual}{rumidas}. 29 | } 30 | \examples{ 31 | \donttest{ 32 | # estimated volatility 33 | est_val<-c(0.01,0.80,0.05,0.05,0,0.1,1.1,-0.3,1.1) 34 | r_t<-sp500['2005/2010'] 35 | X<-rv5['2005/2010']^0.5 36 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 37 | vol<-DAGM_X_cond_vol(est_val,r_t,X,mv_m,K=12) 38 | head(vol) 39 | } 40 | } 41 | \references{ 42 | \insertAllCited{} 43 | } 44 | \seealso{ 45 | \code{\link{mv_into_mat}}. 46 | } 47 | \keyword{internal} 48 | -------------------------------------------------------------------------------- /man/DAGM_X_cond_vol_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{DAGM_X_cond_vol_no_skew} 4 | \alias{DAGM_X_cond_vol_no_skew} 5 | \title{DAGM-X conditional volatility (no skewness)} 6 | \usage{ 7 | DAGM_X_cond_vol_no_skew(param, daily_ret, X, mv_m, K, lag_fun = "Beta") 8 | } 9 | \arguments{ 10 | \item{param}{Vector of estimated values.} 11 | 12 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 13 | 14 | \item{X}{Additional "X" variable, which must be an "xts" object. Morever, "X" must be observed for the same days of daily_ret.} 15 | 16 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 17 | 18 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 19 | 20 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 21 | for the Beta and Exponential Almon lag functions, respectively.} 22 | } 23 | \value{ 24 | The resulting vector is an "xts" object representing the conditional volatility. 25 | } 26 | \description{ 27 | Obtains the conditional volatility for the DAGM-X. 28 | For details, see \insertCite{amendola_candila_gallo:2019;textual}{rumidas}. 29 | } 30 | \examples{ 31 | \donttest{ 32 | # estimated volatility 33 | est_val<-c(0.01,0.80,0.05,0,0.1,1.1,-0.3,1.1) 34 | r_t<-sp500['2005/2010'] 35 | X<-rv5['2005/2010']^0.5 36 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 37 | vol<-DAGM_X_cond_vol_no_skew(est_val,r_t,X,mv_m,K=12) 38 | head(vol) 39 | } 40 | } 41 | \references{ 42 | \insertAllCited{} 43 | } 44 | \seealso{ 45 | \code{\link{mv_into_mat}}. 46 | } 47 | \keyword{internal} 48 | -------------------------------------------------------------------------------- /man/DAGM_X_loglik.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{DAGM_X_loglik} 4 | \alias{DAGM_X_loglik} 5 | \title{DAGM-X log-likelihood (with skewness)} 6 | \usage{ 7 | DAGM_X_loglik(param, daily_ret, X, mv_m, K, distribution, lag_fun = "Beta") 8 | } 9 | \arguments{ 10 | \item{param}{Vector of starting values.} 11 | 12 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 13 | 14 | \item{X}{Additional "X" variable, which must be an "xts" object. Morever, "X" must be observed for the same days of daily_ret.} 15 | 16 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 17 | 18 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 19 | 20 | \item{distribution}{The conditional density to use for the innovations. At the moment, valid choices are "norm" and "std", for the Normal 21 | and Student-t distributions.} 22 | 23 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 24 | for the Beta and Exponential Almon lag functions, respectively.} 25 | } 26 | \value{ 27 | The resulting vector is the log-likelihood value for each \eqn{i,t}. 28 | } 29 | \description{ 30 | Obtains the log-likelihood of the DAGM-X, with an asymmetric term linked to past negative returns, 31 | according to two errors' conditional distributions: Normal and Student-t. 32 | For details, see \insertCite{amendola_candila_gallo:2019;textual}{rumidas}. 33 | } 34 | \examples{ 35 | \donttest{ 36 | # conditional density of the innovations: normal 37 | start_val<-c(0.01,0.80,0.05,0.05,0,0,1.1,0,1.1) 38 | r_t<-sp500['2005/2010'] 39 | X<-rv5['2005/2010']^0.5 40 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 41 | sum(DAGM_X_loglik(start_val,r_t,X,mv_m,K=12,distribution="norm")) 42 | } 43 | } 44 | \references{ 45 | \insertAllCited{} 46 | } 47 | \seealso{ 48 | \code{\link{mv_into_mat}}. 49 | } 50 | \keyword{internal} 51 | -------------------------------------------------------------------------------- /man/DAGM_X_loglik_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{DAGM_X_loglik_no_skew} 4 | \alias{DAGM_X_loglik_no_skew} 5 | \title{DAGM-X log-likelihood (no skewness)} 6 | \usage{ 7 | DAGM_X_loglik_no_skew( 8 | param, 9 | daily_ret, 10 | X, 11 | mv_m, 12 | K, 13 | distribution, 14 | lag_fun = "Beta" 15 | ) 16 | } 17 | \arguments{ 18 | \item{param}{Vector of starting values.} 19 | 20 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 21 | 22 | \item{X}{Additional "X" variable, which must be an "xts" object. Morever, "X" must be observed for the same days of daily_ret.} 23 | 24 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 25 | 26 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 27 | 28 | \item{distribution}{The conditional density to use for the innovations. At the moment, valid choices are "norm" and "std", for the Normal 29 | and Student-t distributions.} 30 | 31 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 32 | for the Beta and Exponential Almon lag functions, respectively.} 33 | } 34 | \value{ 35 | The resulting vector is the log-likelihood value for each \eqn{i,t}. 36 | } 37 | \description{ 38 | Obtains the log-likelihood of the DAGM-X, according to two errors' conditional distributions: Normal and Student-t. 39 | For details, see \insertCite{amendola_candila_gallo:2019;textual}{rumidas}. 40 | } 41 | \examples{ 42 | \donttest{ 43 | # conditional density of the innovations: normal 44 | start_val<-c(0.01,0.80,0.05,0,0,1.1,0,1.1) 45 | r_t<-sp500['2005/2010'] 46 | X<-rv5['2005/2010']^0.5 47 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 48 | sum(DAGM_X_loglik_no_skew(start_val,r_t,X,mv_m,K=12,distribution="norm")) 49 | } 50 | } 51 | \references{ 52 | \insertAllCited{} 53 | } 54 | \seealso{ 55 | \code{\link{mv_into_mat}}. 56 | } 57 | \keyword{internal} 58 | -------------------------------------------------------------------------------- /man/DAGM_X_long_run_vol.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{DAGM_X_long_run_vol} 4 | \alias{DAGM_X_long_run_vol} 5 | \title{DAGM-X (daily) long-run volatility (with skewness)} 6 | \usage{ 7 | DAGM_X_long_run_vol(param, daily_ret, X, mv_m, K, lag_fun = "Beta") 8 | } 9 | \arguments{ 10 | \item{param}{Vector of estimated values. It must be a eight- or nine- dimensional vector. See the examples below.} 11 | 12 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 13 | 14 | \item{X}{Additional "X" variable, which must be an "xts" object. Morever, "X" must be observed for the same days of daily_ret.} 15 | 16 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 17 | 18 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 19 | 20 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 21 | for the Beta and Exponential Almon lag functions, respectively.} 22 | } 23 | \value{ 24 | The resulting vector is an "xts" object representing the conditional volatility. 25 | } 26 | \description{ 27 | Obtains the daily long-run volatility for the DAGM-X, with an asymmetric term linked to past negative returns. 28 | For details, see \insertCite{amendola_candila_gallo:2019;textual}{rumidas}. 29 | } 30 | \examples{ 31 | \donttest{ 32 | est_val<-c(0.01,0.80,0.05,0.05,0,0.1,1.1,-0.3,1.1) 33 | r_t<-sp500['/2010'] 34 | X<-rv5['/2010']^0.5 35 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 36 | head(DAGM_X_long_run_vol(est_val,r_t,X,mv_m,K=12)) 37 | } 38 | } 39 | \references{ 40 | \insertAllCited{} 41 | } 42 | \seealso{ 43 | \code{\link{mv_into_mat}}. 44 | } 45 | \keyword{internal} 46 | -------------------------------------------------------------------------------- /man/DAGM_X_long_run_vol_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{DAGM_X_long_run_vol_no_skew} 4 | \alias{DAGM_X_long_run_vol_no_skew} 5 | \title{DAGM-X (daily) long-run volatility (no skewness)} 6 | \usage{ 7 | DAGM_X_long_run_vol_no_skew(param, daily_ret, X, mv_m, K, lag_fun = "Beta") 8 | } 9 | \arguments{ 10 | \item{param}{Vector of estimated values. It must be a eight- or nine- dimensional vector. See the examples below.} 11 | 12 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 13 | 14 | \item{X}{Additional "X" variable, which must be an "xts" object. Morever, "X" must be observed for the same days of daily_ret.} 15 | 16 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 17 | 18 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 19 | 20 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 21 | for the Beta and Exponential Almon lag functions, respectively.} 22 | } 23 | \value{ 24 | The resulting vector is an "xts" object representing the conditional volatility. 25 | } 26 | \description{ 27 | Obtains the daily long-run volatility for the DAGM-X. 28 | For details, see \insertCite{amendola_candila_gallo:2019;textual}{rumidas}. 29 | } 30 | \examples{ 31 | \donttest{ 32 | est_val<-c(0.01,0.80,0.05,0,0.1,1.1,-0.3,1.1) 33 | r_t<-sp500['/2010'] 34 | X<-rv5['/2010']^0.5 35 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 36 | head(DAGM_X_long_run_vol_no_skew(est_val,r_t,X,mv_m,K=12)) 37 | } 38 | } 39 | \references{ 40 | \insertAllCited{} 41 | } 42 | \seealso{ 43 | \code{\link{mv_into_mat}}. 44 | } 45 | \keyword{internal} 46 | -------------------------------------------------------------------------------- /man/DAGM_cond_vol.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{DAGM_cond_vol} 4 | \alias{DAGM_cond_vol} 5 | \title{DAGM conditional volatility (with skewness)} 6 | \usage{ 7 | DAGM_cond_vol(param, daily_ret, mv_m, K, lag_fun = "Beta") 8 | } 9 | \arguments{ 10 | \item{param}{Vector of estimated values. It must be a eight- or nine- dimensional vector. See the examples below.} 11 | 12 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 13 | 14 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 15 | 16 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 17 | 18 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 19 | for the Beta and Exponential Almon lag functions, respectively.} 20 | } 21 | \value{ 22 | The resulting vector is an "xts" object representing the conditional volatility. 23 | } 24 | \description{ 25 | Obtains the conditional volatility for the DAGM, with an asymmetric term linked to past negative returns. 26 | For details, see \insertCite{amendola_candila_gallo:2019;textual}{rumidas}. 27 | } 28 | \examples{ 29 | \donttest{ 30 | # estimated volatility 31 | est_val<-c(0.01,0.80,0.05,0,0.1,1.1,-0.3,1.1) 32 | r_t<-sp500['2005/2010'] 33 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 34 | vol<-DAGM_cond_vol(est_val,r_t,mv_m,K=12) 35 | head(vol) 36 | } 37 | } 38 | \references{ 39 | \insertAllCited{} 40 | } 41 | \seealso{ 42 | \code{\link{mv_into_mat}}. 43 | } 44 | \keyword{internal} 45 | -------------------------------------------------------------------------------- /man/DAGM_cond_vol_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{DAGM_cond_vol_no_skew} 4 | \alias{DAGM_cond_vol_no_skew} 5 | \title{DAGM conditional volatility (no skewness)} 6 | \usage{ 7 | DAGM_cond_vol_no_skew(param, daily_ret, mv_m, K, lag_fun = "Beta") 8 | } 9 | \arguments{ 10 | \item{param}{Vector of estimated values. It must be a seven- or eight- dimensional vector. See the examples below.} 11 | 12 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 13 | 14 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 15 | 16 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 17 | 18 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 19 | for the Beta and Exponential Almon lag functions, respectively.} 20 | } 21 | \value{ 22 | The resulting vector is an "xts" object representing the conditional volatility. 23 | } 24 | \description{ 25 | Obtains the conditional volatility for the DAGM. 26 | For details, see \insertCite{amendola_candila_gallo:2019;textual}{rumidas}. 27 | } 28 | \examples{ 29 | # est_val<-c(0.01,0.80,0,0.1,1.1,-0.3,1.1) 30 | # r_t<-sp500['/2010'] 31 | # mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 32 | # head(DAGM_cond_vol_no_skew(est_val,r_t,mv_m,K=12)) 33 | } 34 | \references{ 35 | \insertAllCited{} 36 | } 37 | \seealso{ 38 | \code{\link{mv_into_mat}}. 39 | } 40 | \keyword{internal} 41 | -------------------------------------------------------------------------------- /man/DAGM_loglik.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{DAGM_loglik} 4 | \alias{DAGM_loglik} 5 | \title{DAGM log-likelihood (with skewness)} 6 | \usage{ 7 | DAGM_loglik(param, daily_ret, mv_m, K, distribution, lag_fun = "Beta") 8 | } 9 | \arguments{ 10 | \item{param}{Vector of starting values.} 11 | 12 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 13 | 14 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 15 | 16 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 17 | 18 | \item{distribution}{The conditional density to use for the innovations. At the moment, valid choices are "norm" and "std", for the Normal 19 | and Student-t distributions.} 20 | 21 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 22 | for the Beta and Exponential Almon lag functions, respectively.} 23 | } 24 | \value{ 25 | The resulting vector is the log-likelihood value for each \eqn{i,t}. 26 | } 27 | \description{ 28 | Obtains the log-likelihood of the DAGM, with an asymmetric term linked to past negative returns, 29 | according to two errors' conditional distributions: Normal and Student-t. 30 | For details, see \insertCite{amendola_candila_gallo:2019;textual}{rumidas}. 31 | } 32 | \examples{ 33 | \donttest{ 34 | # conditional density of the innovations: normal 35 | start_val<-c(0.01,0.80,0.05,0,0,1.1,0,1.1) 36 | r_t<-sp500['2005/2010'] 37 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 38 | sum(DAGM_loglik(start_val,r_t,mv_m,K=12,distribution="norm")) 39 | } 40 | } 41 | \references{ 42 | \insertAllCited{} 43 | } 44 | \seealso{ 45 | \code{\link{mv_into_mat}}. 46 | } 47 | \keyword{internal} 48 | -------------------------------------------------------------------------------- /man/DAGM_loglik_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{DAGM_loglik_no_skew} 4 | \alias{DAGM_loglik_no_skew} 5 | \title{DAGM log-likelihood (without skewness)} 6 | \usage{ 7 | DAGM_loglik_no_skew(param, daily_ret, mv_m, K, distribution, lag_fun = "Beta") 8 | } 9 | \arguments{ 10 | \item{param}{Vector of starting values.} 11 | 12 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 13 | 14 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 15 | 16 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 17 | 18 | \item{distribution}{The conditional density to use for the innovations. At the moment, valid choices are "norm" and "std", for the Normal 19 | and Student-t distributions.} 20 | 21 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 22 | for the Beta and Exponential Almon lag functions, respectively.} 23 | } 24 | \value{ 25 | The resulting vector is the log-likelihood value for each \eqn{i,t}. 26 | } 27 | \description{ 28 | Obtains the log-likelihood of the DAGM, without the asymmetric term linked to past negative returns, 29 | according to two errors' conditional distributions: Normal and Student-t. 30 | For details, see \insertCite{amendola_candila_gallo:2019;textual}{rumidas}. 31 | } 32 | \examples{ 33 | \donttest{ 34 | # conditional density of the innovations: normal 35 | start_val<-c(alpha=0.01,beta=0.80,gamma_1=0.05,m=0,theta_pos=0,w2_pos=1.1,theta_neg=0,w2_neg=1.1) 36 | r_t<-sp500['2005/2010'] 37 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 38 | sum(DAGM_loglik(start_val,r_t,mv_m,K=12,distribution="norm")) 39 | 40 | # conditional density of the innovations: Student-t 41 | start_val<-c(0.01,0.80,0.05,0,0,1.1,0,1.1,5) 42 | r_t<-sp500['2005/2010'] 43 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 44 | sum(DAGM_loglik(start_val,r_t,mv_m,K=12,distribution="std")) 45 | } 46 | } 47 | \references{ 48 | \insertAllCited{} 49 | } 50 | \seealso{ 51 | \code{\link{mv_into_mat}}. 52 | } 53 | \keyword{internal} 54 | -------------------------------------------------------------------------------- /man/DAGM_long_run_vol.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{DAGM_long_run_vol} 4 | \alias{DAGM_long_run_vol} 5 | \title{DAGM (daily) long-run volatility (with skewness)} 6 | \usage{ 7 | DAGM_long_run_vol(param, daily_ret, mv_m, K, lag_fun = "Beta") 8 | } 9 | \arguments{ 10 | \item{param}{Vector of estimated values. It must be a eight- or nine- dimensional vector. See the examples below.} 11 | 12 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 13 | 14 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 15 | 16 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 17 | 18 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 19 | for the Beta and Exponential Almon lag functions, respectively.} 20 | } 21 | \value{ 22 | The resulting vector is an "xts" object representing the conditional volatility. 23 | } 24 | \description{ 25 | Obtains the daily long-run volatility for the DAGM, with an asymmetric term linked to past negative returns. 26 | For details, see \insertCite{amendola_candila_gallo:2019;textual}{rumidas}. 27 | } 28 | \examples{ 29 | \donttest{ 30 | est_val<-c(0.01,0.80,0.05,0,0.1,1.1,-0.3,1.1) 31 | r_t<-sp500['/2010'] 32 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 33 | head(DAGM_long_run_vol(est_val,r_t,mv_m,K=12)) 34 | } 35 | } 36 | \references{ 37 | \insertAllCited{} 38 | } 39 | \seealso{ 40 | \code{\link{mv_into_mat}}. 41 | } 42 | \keyword{internal} 43 | -------------------------------------------------------------------------------- /man/DAGM_long_run_vol_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{DAGM_long_run_vol_no_skew} 4 | \alias{DAGM_long_run_vol_no_skew} 5 | \title{DAGM (daily) long-run volatility (no skewness)} 6 | \usage{ 7 | DAGM_long_run_vol_no_skew(param, daily_ret, mv_m, K, lag_fun = "Beta") 8 | } 9 | \arguments{ 10 | \item{param}{Vector of estimated values. It must be a seven- or eight- dimensional vector. See the examples below.} 11 | 12 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 13 | 14 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 15 | 16 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 17 | 18 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 19 | for the Beta and Exponential Almon lag functions, respectively.} 20 | } 21 | \value{ 22 | The resulting vector is an "xts" object representing the long-run volatility. 23 | } 24 | \description{ 25 | Obtains the daily long-run volatility for the DAGM. 26 | For details, see \insertCite{amendola_candila_gallo:2019;textual}{rumidas}. 27 | } 28 | \examples{ 29 | # est_val<-c(0.01,0.80,0,0.1,1.1,-0.3,1.1) 30 | # r_t<-sp500['/2010'] 31 | # mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 32 | # head(DAGM_long_run_vol_no_skew(est_val,r_t,mv_m,K=12)) 33 | } 34 | \references{ 35 | \insertAllCited{} 36 | } 37 | \seealso{ 38 | \code{\link{mv_into_mat}}. 39 | } 40 | \keyword{internal} 41 | -------------------------------------------------------------------------------- /man/GM_2M_cond_vol.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{GM_2M_cond_vol} 4 | \alias{GM_2M_cond_vol} 5 | \title{GARCH-MIDAS-2M conditional volatility (with skewness)} 6 | \usage{ 7 | GM_2M_cond_vol(param, daily_ret, mv_m_1, mv_m_2, K_1, K_2, lag_fun = "Beta") 8 | } 9 | \arguments{ 10 | \item{param}{Vector of starting values.} 11 | 12 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 13 | 14 | \item{mv_m_1}{first MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 15 | 16 | \item{mv_m_2}{second MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 17 | 18 | \item{K_1}{Number of (lagged) realizations of the first MIDAS variable to consider.} 19 | 20 | \item{K_2}{Number of (lagged) realizations of the second MIDAS variable to consider.} 21 | 22 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 23 | for the Beta and Exponential Almon lag functions, respectively.} 24 | } 25 | \value{ 26 | The resulting vector is the conditional volatility for each \eqn{i,t}. 27 | } 28 | \description{ 29 | Obtains the conditional volatility of the GARCH-MIDAS with two low-frequency variables, with an asymmetric term linked to past negative returns. 30 | For details, see \insertCite{engle_ghysels_sohn_2013;textual}{rumidas} and \insertCite{conrad_lock_2015;textual}{rumidas}. 31 | } 32 | \examples{ 33 | \donttest{ 34 | est_val<-c(alpha=0.01,beta=0.8,gamma=0.05,m=0,theta_1=0.1,w2_1=2,theta_2=0.1,w2_2=2) 35 | r_t<-sp500['2005/2010'] 36 | mv_m_1<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 37 | mv_m_2<-mv_into_mat(r_t,diff(indpro),K=24,"monthly") 38 | head(GM_2M_cond_vol(est_val,r_t,mv_m_1,mv_m_2,K_1=12,K_2=24)) 39 | } 40 | } 41 | \references{ 42 | \insertAllCited{} 43 | } 44 | \seealso{ 45 | \code{\link{mv_into_mat}}. 46 | } 47 | \keyword{internal} 48 | -------------------------------------------------------------------------------- /man/GM_2M_cond_vol_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{GM_2M_cond_vol_no_skew} 4 | \alias{GM_2M_cond_vol_no_skew} 5 | \title{GARCH-MIDAS-2M conditional volatility (without skewness)} 6 | \usage{ 7 | GM_2M_cond_vol_no_skew( 8 | param, 9 | daily_ret, 10 | mv_m_1, 11 | mv_m_2, 12 | K_1, 13 | K_2, 14 | lag_fun = "Beta" 15 | ) 16 | } 17 | \arguments{ 18 | \item{param}{Vector of starting values.} 19 | 20 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 21 | 22 | \item{mv_m_1}{first MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 23 | 24 | \item{mv_m_2}{second MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 25 | 26 | \item{K_1}{Number of (lagged) realizations of the first MIDAS variable to consider.} 27 | 28 | \item{K_2}{Number of (lagged) realizations of the second MIDAS variable to consider.} 29 | 30 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 31 | for the Beta and Exponential Almon lag functions, respectively.} 32 | } 33 | \value{ 34 | The resulting vector is the conditional volatility for each \eqn{i,t}. 35 | } 36 | \description{ 37 | Obtains the conditional volatility of the GARCH-MIDAS with two low-frequency variables. 38 | For details, see \insertCite{engle_ghysels_sohn_2013;textual}{rumidas} and \insertCite{conrad_lock_2015;textual}{rumidas}. 39 | } 40 | \examples{ 41 | \donttest{ 42 | est_val<-c(alpha=0.01,beta=0.8,m=0,theta_1=0.1,w2_1=2,theta_2=0.1,w2_2=2) 43 | r_t<-sp500['2005/2010'] 44 | mv_m_1<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 45 | mv_m_2<-mv_into_mat(r_t,diff(indpro),K=24,"monthly") 46 | head(GM_2M_cond_vol_no_skew(est_val,r_t,mv_m_1,mv_m_2,K_1=12,K_2=24)) 47 | } 48 | } 49 | \references{ 50 | \insertAllCited{} 51 | } 52 | \seealso{ 53 | \code{\link{mv_into_mat}}. 54 | } 55 | \keyword{internal} 56 | -------------------------------------------------------------------------------- /man/GM_2M_loglik.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{GM_2M_loglik} 4 | \alias{GM_2M_loglik} 5 | \title{GARCH-MIDAS-2M log-likelihood (with skewness)} 6 | \usage{ 7 | GM_2M_loglik( 8 | param, 9 | daily_ret, 10 | mv_m_1, 11 | mv_m_2, 12 | K_1, 13 | K_2, 14 | distribution, 15 | lag_fun = "Beta" 16 | ) 17 | } 18 | \arguments{ 19 | \item{param}{Vector of starting values.} 20 | 21 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 22 | 23 | \item{mv_m_1}{first MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 24 | 25 | \item{mv_m_2}{second MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 26 | 27 | \item{K_1}{Number of (lagged) realizations of the first MIDAS variable to consider.} 28 | 29 | \item{K_2}{Number of (lagged) realizations of the second MIDAS variable to consider.} 30 | 31 | \item{distribution}{The conditional density to use for the innovations. At the moment, valid choices are "norm" and "std", for the Normal 32 | and Student-t distributions.} 33 | 34 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 35 | for the Beta and Exponential Almon lag functions, respectively.} 36 | } 37 | \value{ 38 | The resulting vector is the log-likelihood value for each \eqn{i,t}. 39 | } 40 | \description{ 41 | Obtains the log-likelihood of the GARCH-MIDAS with two low-frequency variables, with an asymmetric term linked to past negative returns, 42 | according to two errors' conditional distributions: Normal and Student-t. 43 | For details, see \insertCite{engle_ghysels_sohn_2013;textual}{rumidas} and \insertCite{conrad_lock_2015;textual}{rumidas}. 44 | } 45 | \examples{ 46 | \donttest{ 47 | # conditional density of the innovations: normal 48 | start_val<-c(alpha=0.01,beta=0.8,gamma=0.05,m=0,theta_1=0.1,w2_1=2,theta_2=0.1,w2_2=2) 49 | r_t<-sp500['2005/2010'] 50 | mv_m_1<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 51 | mv_m_2<-mv_into_mat(r_t,diff(indpro),K=24,"monthly") 52 | sum(GM_2M_loglik(start_val,r_t,mv_m_1,mv_m_2,K_1=12,K_2=24,distribution="norm")) 53 | } 54 | } 55 | \references{ 56 | \insertAllCited{} 57 | } 58 | \seealso{ 59 | \code{\link{mv_into_mat}}. 60 | } 61 | \keyword{internal} 62 | -------------------------------------------------------------------------------- /man/GM_2M_loglik_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{GM_2M_loglik_no_skew} 4 | \alias{GM_2M_loglik_no_skew} 5 | \title{GARCH-MIDAS-2M log-likelihood (without skewness)} 6 | \usage{ 7 | GM_2M_loglik_no_skew( 8 | param, 9 | daily_ret, 10 | mv_m_1, 11 | mv_m_2, 12 | K_1, 13 | K_2, 14 | distribution, 15 | lag_fun = "Beta" 16 | ) 17 | } 18 | \arguments{ 19 | \item{param}{Vector of starting values.} 20 | 21 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 22 | 23 | \item{mv_m_1}{first MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 24 | 25 | \item{mv_m_2}{second MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 26 | 27 | \item{K_1}{Number of (lagged) realizations of the first MIDAS variable to consider.} 28 | 29 | \item{K_2}{Number of (lagged) realizations of the second MIDAS variable to consider.} 30 | 31 | \item{distribution}{The conditional density to use for the innovations. At the moment, valid choices are "norm" and "std", for the Normal 32 | and Student-t distributions.} 33 | 34 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 35 | for the Beta and Exponential Almon lag functions, respectively.} 36 | } 37 | \value{ 38 | The resulting vector is the log-likelihood value for each \eqn{i,t}. 39 | } 40 | \description{ 41 | Obtains the log-likelihood of the GARCH-MIDAS with two low-frequency variables, 42 | according to two errors' conditional distributions: Normal and Student-t. 43 | For details, see \insertCite{engle_ghysels_sohn_2013;textual}{rumidas} and \insertCite{conrad_lock_2015;textual}{rumidas}. 44 | } 45 | \examples{ 46 | \donttest{ 47 | # conditional density of the innovations: normal 48 | start_val<-c(alpha=0.01,beta=0.8,m=0,theta_1=0.1,w2_1=2,theta_2=0.1,w2_2=2) 49 | r_t<-sp500['2005/2010'] 50 | mv_m_1<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 51 | mv_m_2<-mv_into_mat(r_t,diff(indpro),K=24,"monthly") 52 | sum(GM_2M_loglik_no_skew(start_val,r_t,mv_m_1,mv_m_2,K_1=12,K_2=24,distribution="norm")) 53 | } 54 | } 55 | \references{ 56 | \insertAllCited{} 57 | } 58 | \seealso{ 59 | \code{\link{mv_into_mat}}. 60 | } 61 | \keyword{internal} 62 | -------------------------------------------------------------------------------- /man/GM_2M_long_run_vol.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{GM_2M_long_run_vol} 4 | \alias{GM_2M_long_run_vol} 5 | \title{GARCH-MIDAS-2M long-run volatility (with skewness)} 6 | \usage{ 7 | GM_2M_long_run_vol( 8 | param, 9 | daily_ret, 10 | mv_m_1, 11 | mv_m_2, 12 | K_1, 13 | K_2, 14 | lag_fun = "Beta" 15 | ) 16 | } 17 | \arguments{ 18 | \item{param}{Vector of starting values.} 19 | 20 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 21 | 22 | \item{mv_m_1}{first MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 23 | 24 | \item{mv_m_2}{second MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 25 | 26 | \item{K_1}{Number of (lagged) realizations of the first MIDAS variable to consider.} 27 | 28 | \item{K_2}{Number of (lagged) realizations of the second MIDAS variable to consider.} 29 | 30 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 31 | for the Beta and Exponential Almon lag functions, respectively.} 32 | } 33 | \value{ 34 | The resulting vector is the long-run volatility for each \eqn{i,t}. 35 | } 36 | \description{ 37 | Obtains the long-run volatility of the GARCH-MIDAS with two low-frequency variables, with an asymmetric term linked to past negative returns. 38 | For details, see \insertCite{engle_ghysels_sohn_2013;textual}{rumidas} and \insertCite{conrad_lock_2015;textual}{rumidas}. 39 | } 40 | \examples{ 41 | \donttest{ 42 | # conditional density of the innovations: normal 43 | est_val<-c(alpha=0.01,beta=0.8,gamma=0.05,m=0,theta_1=0.1,w2_1=2,theta_2=0.1,w2_2=2) 44 | r_t<-sp500['2005/2010'] 45 | mv_m_1<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 46 | mv_m_2<-mv_into_mat(r_t,diff(indpro),K=24,"monthly") 47 | head(GM_2M_long_run_vol(est_val,r_t,mv_m_1,mv_m_2,K_1=12,K_2=24)) 48 | } 49 | } 50 | \references{ 51 | \insertAllCited{} 52 | } 53 | \seealso{ 54 | \code{\link{mv_into_mat}}. 55 | } 56 | \keyword{internal} 57 | -------------------------------------------------------------------------------- /man/GM_2M_long_run_vol_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{GM_2M_long_run_vol_no_skew} 4 | \alias{GM_2M_long_run_vol_no_skew} 5 | \title{GARCH-MIDAS-2M long-run volatility (without skewness)} 6 | \usage{ 7 | GM_2M_long_run_vol_no_skew( 8 | param, 9 | daily_ret, 10 | mv_m_1, 11 | mv_m_2, 12 | K_1, 13 | K_2, 14 | lag_fun = "Beta" 15 | ) 16 | } 17 | \arguments{ 18 | \item{param}{Vector of starting values.} 19 | 20 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 21 | 22 | \item{mv_m_1}{first MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 23 | 24 | \item{mv_m_2}{second MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 25 | 26 | \item{K_1}{Number of (lagged) realizations of the first MIDAS variable to consider.} 27 | 28 | \item{K_2}{Number of (lagged) realizations of the second MIDAS variable to consider.} 29 | 30 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 31 | for the Beta and Exponential Almon lag functions, respectively.} 32 | } 33 | \value{ 34 | The resulting vector is the long-run volatility for each \eqn{i,t}. 35 | } 36 | \description{ 37 | Obtains the long-run volatility of the GARCH-MIDAS with two low-frequency variables. 38 | For details, see \insertCite{engle_ghysels_sohn_2013;textual}{rumidas} and \insertCite{conrad_lock_2015;textual}{rumidas}. 39 | } 40 | \examples{ 41 | \donttest{ 42 | # conditional density of the innovations: normal 43 | est_val<-c(alpha=0.01,beta=0.8,m=0,theta_1=0.1,w2_1=2,theta_2=0.1,w2_2=2) 44 | r_t<-sp500['2005/2010'] 45 | mv_m_1<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 46 | mv_m_2<-mv_into_mat(r_t,diff(indpro),K=24,"monthly") 47 | head(GM_2M_long_run_vol_no_skew(est_val,r_t,mv_m_1,mv_m_2,K_1=12,K_2=24)) 48 | } 49 | } 50 | \references{ 51 | \insertAllCited{} 52 | } 53 | \seealso{ 54 | \code{\link{mv_into_mat}}. 55 | } 56 | \keyword{internal} 57 | -------------------------------------------------------------------------------- /man/GM_X_cond_vol.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{GM_X_cond_vol} 4 | \alias{GM_X_cond_vol} 5 | \title{GARCH-MIDAS-X conditional volatility (with skewness)} 6 | \usage{ 7 | GM_X_cond_vol(param, daily_ret, X, mv_m, K, lag_fun = "Beta") 8 | } 9 | \arguments{ 10 | \item{param}{Vector of estimated values.} 11 | 12 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 13 | 14 | \item{X}{Additional "X" variable, which must be an "xts" object. Morever, "X" must be observed for the same days of daily_ret.} 15 | 16 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 17 | 18 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 19 | 20 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 21 | for the Beta and Exponential Almon lag functions, respectively.} 22 | } 23 | \value{ 24 | The resulting vector is an "xts" object representing the conditional volatility. 25 | } 26 | \description{ 27 | Obtains the estimated conditional volatility for the GARCH-MIDAS-X model, with an asymmetric term linked to past negative returns. 28 | For details, see \insertCite{engle_ghysels_sohn_2013;textual}{rumidas} and \insertCite{conrad_lock_2015;textual}{rumidas}. 29 | } 30 | \examples{ 31 | \donttest{ 32 | # estimated volatility 33 | est_val<-c(alpha=0.01,beta=0.8,gamma=0.05,z=0.1,m=2,theta=0.1,w2=2) 34 | r_t<-sp500['/2010'] 35 | X<-rv5['/2010']^0.5 36 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 37 | head(GM_X_cond_vol(est_val,r_t,X,mv_m,K=12)) 38 | } 39 | } 40 | \references{ 41 | \insertAllCited{} 42 | } 43 | \seealso{ 44 | \code{\link{mv_into_mat}}. 45 | } 46 | \keyword{internal} 47 | -------------------------------------------------------------------------------- /man/GM_X_cond_vol_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{GM_X_cond_vol_no_skew} 4 | \alias{GM_X_cond_vol_no_skew} 5 | \title{GARCH-MIDAS-X conditional volatility (without skewness)} 6 | \usage{ 7 | GM_X_cond_vol_no_skew(param, daily_ret, X, mv_m, K, lag_fun = "Beta") 8 | } 9 | \arguments{ 10 | \item{param}{Vector of estimated values.} 11 | 12 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 13 | 14 | \item{X}{Additional "X" variable, which must be an "xts" object. Morever, "X" must be observed for the same days of daily_ret.} 15 | 16 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 17 | 18 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 19 | 20 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 21 | for the Beta and Exponential Almon lag functions, respectively.} 22 | } 23 | \value{ 24 | The resulting vector is an "xts" object representing the conditional volatility. 25 | } 26 | \description{ 27 | Obtains the estimated conditional volatility for the GARCH-MIDAS-X model, without the skewness parameter in the short--run. 28 | For details, see \insertCite{engle_ghysels_sohn_2013;textual}{rumidas} and \insertCite{conrad_lock_2015;textual}{rumidas}. 29 | } 30 | \examples{ 31 | \donttest{ 32 | est_val<-c(alpha=0.01,beta=0.8,z=0.1,m=2,theta=0.1,w2=2) 33 | r_t<-sp500['/2010'] 34 | X<-rv5['/2010']^0.5 35 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 36 | head(GM_X_cond_vol_no_skew(est_val,r_t,X,mv_m,K=12)) 37 | } 38 | } 39 | \references{ 40 | \insertAllCited{} 41 | } 42 | \seealso{ 43 | \code{\link{mv_into_mat}}. 44 | } 45 | \keyword{internal} 46 | -------------------------------------------------------------------------------- /man/GM_X_loglik.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{GM_X_loglik} 4 | \alias{GM_X_loglik} 5 | \title{GARCH-MIDAS-X log-likelihood (with skewness)} 6 | \usage{ 7 | GM_X_loglik(param, daily_ret, X, mv_m, K, distribution, lag_fun = "Beta") 8 | } 9 | \arguments{ 10 | \item{param}{Vector of starting values.} 11 | 12 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 13 | 14 | \item{X}{Additional "X" variable, which must be an "xts" object. Morever, "X" must be observed for the same days of daily_ret.} 15 | 16 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 17 | 18 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 19 | 20 | \item{distribution}{The conditional density to use for the innovations. At the moment, valid choices are "norm" and "std", for the Normal 21 | and Student-t distributions.} 22 | 23 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 24 | for the Beta and Exponential Almon lag functions, respectively.} 25 | } 26 | \value{ 27 | The resulting vector is the log-likelihood value for each \eqn{i,t}. 28 | } 29 | \description{ 30 | Obtains the log-likelihood of the GARCH-MIDAS-X, with an asymmetric term linked to past negative returns, 31 | according to two errors' conditional distributions: Normal and Student-t. 32 | For details, see \insertCite{engle_ghysels_sohn_2013;textual}{rumidas} and \insertCite{conrad_lock_2015;textual}{rumidas}. 33 | } 34 | \examples{ 35 | \donttest{ 36 | # conditional density of the innovations: normal 37 | start_val<-c(alpha=0.01,beta=0.8,gamma=0.05,z=0.1,m=0,theta=0.1,w2=2) 38 | r_t<-sp500['2005/2010'] 39 | X<-rv5['2005/2010']^0.5 40 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 41 | sum(GM_X_loglik(start_val,r_t,X=X,mv_m,K=12,distribution="norm")) 42 | 43 | # conditional density of the innovations: Student-t 44 | start_val<-c(alpha=0.01,beta=0.8,gamma=0.05,z=0.1,m=0,theta=0.1,w2=2,shape=5) 45 | r_t<-sp500['2005/2010'] 46 | X<-rv5['2005/2010']^0.5 47 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 48 | sum(GM_X_loglik(start_val,r_t,X=X,mv_m,K=12,distribution="std")) 49 | } 50 | } 51 | \references{ 52 | \insertAllCited{} 53 | } 54 | \seealso{ 55 | \code{\link{mv_into_mat}}. 56 | } 57 | \keyword{internal} 58 | -------------------------------------------------------------------------------- /man/GM_X_loglik_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{GM_X_loglik_no_skew} 4 | \alias{GM_X_loglik_no_skew} 5 | \title{GARCH-MIDAS-X log-likelihood (no skewness)} 6 | \usage{ 7 | GM_X_loglik_no_skew( 8 | param, 9 | daily_ret, 10 | X, 11 | mv_m, 12 | K, 13 | distribution, 14 | lag_fun = "Beta" 15 | ) 16 | } 17 | \arguments{ 18 | \item{param}{Vector of starting values.} 19 | 20 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 21 | 22 | \item{X}{Additional "X" variable, which must be an "xts" object. Morever, "X" must be observed for the same days of daily_ret.} 23 | 24 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 25 | 26 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 27 | 28 | \item{distribution}{The conditional density to use for the innovations. At the moment, valid choices are "norm" and "std", for the Normal 29 | and Student-t distributions.} 30 | 31 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 32 | for the Beta and Exponential Almon lag functions, respectively.} 33 | } 34 | \value{ 35 | The resulting vector is the log-likelihood value for each \eqn{i,t}. 36 | } 37 | \description{ 38 | Obtains the log-likelihood of the GARCH-MIDAS-X, according to two errors' conditional distributions: Normal and Student-t. 39 | For details, see \insertCite{engle_ghysels_sohn_2013;textual}{rumidas} and \insertCite{conrad_lock_2015;textual}{rumidas}. 40 | } 41 | \examples{ 42 | \donttest{ 43 | # conditional density of the innovations: normal 44 | start_val<-c(alpha=0.01,beta=0.8,z=0.1,m=0,theta=0.1,w2=2) 45 | r_t<-sp500['2005/2010'] 46 | X<-rv5['2005/2010']^0.5 47 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 48 | sum(GM_X_loglik_no_skew(start_val,r_t,X,mv_m,K=12,distribution="norm")) 49 | 50 | # conditional density of the innovations: Student-t 51 | start_val<-c(alpha=0.01,beta=0.8,z=0.1,m=0,theta=0.1,w2=2,shape=5) 52 | r_t<-sp500['2005/2010'] 53 | X<-rv5['2005/2010']^0.5 54 | mv_m<-mv_into_mat(r_t,indpro,K=12,"monthly") 55 | sum(GM_X_loglik_no_skew(start_val,r_t,X,mv_m,K=12,distribution="std")) 56 | } 57 | } 58 | \references{ 59 | \insertAllCited{} 60 | } 61 | \seealso{ 62 | \code{\link{mv_into_mat}}. 63 | } 64 | \keyword{internal} 65 | -------------------------------------------------------------------------------- /man/GM_X_long_run_vol.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{GM_X_long_run_vol} 4 | \alias{GM_X_long_run_vol} 5 | \title{GARCH-MIDAS-X (daily) long-run (with skewness)} 6 | \usage{ 7 | GM_X_long_run_vol(param, daily_ret, X, mv_m, K, lag_fun = "Beta") 8 | } 9 | \arguments{ 10 | \item{param}{Vector of estimated values.} 11 | 12 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 13 | 14 | \item{X}{Additional "X" variable, which must be an "xts" object. Morever, "X" must be observed for the same days of daily_ret.} 15 | 16 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 17 | 18 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 19 | 20 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 21 | for the Beta and Exponential Almon lag functions, respectively.} 22 | } 23 | \value{ 24 | The resulting vector is an "xts" object representing the conditional volatility. 25 | } 26 | \description{ 27 | Obtains the estimated daily long-run volatility for the GARCH-MIDAS-X model, with an asymmetric term linked to past negative returns. 28 | For details, see \insertCite{engle_ghysels_sohn_2013;textual}{rumidas} and \insertCite{conrad_lock_2015;textual}{rumidas}. 29 | } 30 | \examples{ 31 | \donttest{ 32 | # estimated volatility 33 | est_val<-c(alpha=0.01,beta=0.8,gamma=0.05,z=0.1,m=2,theta=0.1,w2=2) 34 | r_t<-sp500['/2010'] 35 | X<-rv5['/2010']^0.5 36 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 37 | head(GM_X_long_run_vol(est_val,r_t,X,mv_m,K=12)) 38 | } 39 | } 40 | \references{ 41 | \insertAllCited{} 42 | } 43 | \seealso{ 44 | \code{\link{mv_into_mat}}. 45 | } 46 | \keyword{internal} 47 | -------------------------------------------------------------------------------- /man/GM_X_long_run_vol_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{GM_X_long_run_vol_no_skew} 4 | \alias{GM_X_long_run_vol_no_skew} 5 | \title{GARCH-MIDAS-X (daily) long-run volatility (without skewness)} 6 | \usage{ 7 | GM_X_long_run_vol_no_skew(param, daily_ret, X, mv_m, K, lag_fun = "Beta") 8 | } 9 | \arguments{ 10 | \item{param}{Vector of estimated values.} 11 | 12 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 13 | 14 | \item{X}{Additional "X" variable, which must be an "xts" object. Morever, "X" must be observed for the same days of daily_ret.} 15 | 16 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 17 | 18 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 19 | 20 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 21 | for the Beta and Exponential Almon lag functions, respectively.} 22 | } 23 | \value{ 24 | The resulting vector is an "xts" object representing the conditional volatility. 25 | } 26 | \description{ 27 | Obtains the daily long-run volatility for the GARCH-MIDAS-X model, without the skewness parameter in the short--run. 28 | For details, see \insertCite{engle_ghysels_sohn_2013;textual}{rumidas} and \insertCite{conrad_lock_2015;textual}{rumidas}. 29 | } 30 | \examples{ 31 | \donttest{ 32 | est_val<-c(alpha=0.01,beta=0.8,z=0.1,m=2,theta=0.1,w2=2) 33 | r_t<-sp500['/2010'] 34 | X<-rv5['/2010']^0.5 35 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 36 | head(GM_X_long_run_vol_no_skew(est_val,r_t,X,mv_m,K=12)) 37 | } 38 | } 39 | \references{ 40 | \insertAllCited{} 41 | } 42 | \seealso{ 43 | \code{\link{mv_into_mat}}. 44 | } 45 | \keyword{internal} 46 | -------------------------------------------------------------------------------- /man/GM_cond_vol.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{GM_cond_vol} 4 | \alias{GM_cond_vol} 5 | \title{GARCH-MIDAS conditional volatility (with skewness)} 6 | \usage{ 7 | GM_cond_vol(param, daily_ret, mv_m, K, lag_fun = "Beta") 8 | } 9 | \arguments{ 10 | \item{param}{Vector of estimated values.} 11 | 12 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 13 | 14 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 15 | 16 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 17 | 18 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 19 | for the Beta and Exponential Almon lag functions, respectively.} 20 | } 21 | \value{ 22 | The resulting vector is an "xts" object representing the conditional volatility. 23 | } 24 | \description{ 25 | Obtains the estimated conditional volatility for the GARCH-MIDAS model, with an asymmetric term linked to past negative returns. 26 | For details, see \insertCite{engle_ghysels_sohn_2013;textual}{rumidas} and \insertCite{conrad_lock_2015;textual}{rumidas}. 27 | } 28 | \examples{ 29 | \donttest{ 30 | # estimated volatility 31 | est_val<-c(alpha=0.01,beta=0.8,gamma=0.05,m=2,theta=0.1,w2=2) 32 | r_t<-sp500['/2010'] 33 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 34 | head(GM_cond_vol(est_val,r_t,mv_m,K=12)) 35 | } 36 | } 37 | \references{ 38 | \insertAllCited{} 39 | } 40 | \seealso{ 41 | \code{\link{mv_into_mat}}. 42 | } 43 | \keyword{internal} 44 | -------------------------------------------------------------------------------- /man/GM_cond_vol_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{GM_cond_vol_no_skew} 4 | \alias{GM_cond_vol_no_skew} 5 | \title{GARCH-MIDAS conditional volatility (without skewness)} 6 | \usage{ 7 | GM_cond_vol_no_skew(param, daily_ret, mv_m, K, lag_fun = "Beta") 8 | } 9 | \arguments{ 10 | \item{param}{Vector of estimated values.} 11 | 12 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 13 | 14 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 15 | 16 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 17 | 18 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 19 | for the Beta and Exponential Almon lag functions, respectively.} 20 | } 21 | \value{ 22 | The resulting vector is an "xts" object representing the conditional volatility. 23 | } 24 | \description{ 25 | Obtains the estimated conditional volatility for the GARCH-MIDAS model, without the skewness parameter in the short--run. 26 | For details, see \insertCite{engle_ghysels_sohn_2013;textual}{rumidas} and \insertCite{conrad_lock_2015;textual}{rumidas}. 27 | } 28 | \examples{ 29 | \donttest{ 30 | est_val<-c(alpha=0.01,beta=0.8,m=2,theta=0.1,w2=2) 31 | r_t<-sp500['/2010'] 32 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 33 | head(GM_cond_vol_no_skew(est_val,r_t,mv_m,K=12)) 34 | } 35 | } 36 | \references{ 37 | \insertAllCited{} 38 | } 39 | \seealso{ 40 | \code{\link{mv_into_mat}}. 41 | } 42 | \keyword{internal} 43 | -------------------------------------------------------------------------------- /man/GM_loglik.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{GM_loglik} 4 | \alias{GM_loglik} 5 | \title{GARCH-MIDAS log-likelihood (with skewness)} 6 | \usage{ 7 | GM_loglik(param, daily_ret, mv_m, K, distribution, lag_fun = "Beta") 8 | } 9 | \arguments{ 10 | \item{param}{Vector of starting values.} 11 | 12 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 13 | 14 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 15 | 16 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 17 | 18 | \item{distribution}{The conditional density to use for the innovations. At the moment, valid choices are "norm" and "std", for the Normal 19 | and Student-t distributions.} 20 | 21 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 22 | for the Beta and Exponential Almon lag functions, respectively.} 23 | } 24 | \value{ 25 | The resulting vector is the log-likelihood value for each \eqn{i,t}. 26 | } 27 | \description{ 28 | Obtains the log-likelihood of the GARCH-MIDAS, with an asymmetric term linked to past negative returns, 29 | according to two errors' conditional distributions: Normal and Student-t. 30 | For details, see \insertCite{engle_ghysels_sohn_2013;textual}{rumidas} and \insertCite{conrad_lock_2015;textual}{rumidas}. 31 | } 32 | \examples{ 33 | \donttest{ 34 | # conditional density of the innovations: normal 35 | start_val<-c(alpha=0.01,beta=0.8,gamma=0.05,m=0,theta=0.1,w2=2) 36 | r_t<-sp500['2005/2010'] 37 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 38 | sum(GM_loglik(start_val,r_t,mv_m,K=12,distribution="norm")) 39 | 40 | # conditional density of the innovations: Student-t 41 | start_val<-c(alpha=0.01,beta=0.8,gamma=0.05,m=0,theta=0.1,w2=2,shape=5) 42 | r_t<-sp500['2005/2010'] 43 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 44 | sum(GM_loglik(start_val,r_t,mv_m,K=12,distribution="std")) 45 | } 46 | } 47 | \references{ 48 | \insertAllCited{} 49 | } 50 | \seealso{ 51 | \code{\link{mv_into_mat}}. 52 | } 53 | \keyword{internal} 54 | -------------------------------------------------------------------------------- /man/GM_loglik_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{GM_loglik_no_skew} 4 | \alias{GM_loglik_no_skew} 5 | \title{GARCH-MIDAS log-likelihood (no skewness)} 6 | \usage{ 7 | GM_loglik_no_skew(param, daily_ret, mv_m, K, distribution, lag_fun = "Beta") 8 | } 9 | \arguments{ 10 | \item{param}{Vector of starting values.} 11 | 12 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 13 | 14 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 15 | 16 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 17 | 18 | \item{distribution}{The conditional density to use for the innovations. At the moment, valid choices are "norm" and "std", for the Normal 19 | and Student-t distributions.} 20 | 21 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 22 | for the Beta and Exponential Almon lag functions, respectively.} 23 | } 24 | \value{ 25 | The resulting vector is the log-likelihood value for each \eqn{i,t}. 26 | } 27 | \description{ 28 | Obtains the log-likelihood of the GARCH-MIDAS, according to two errors' conditional distributions: Normal and Student-t. 29 | For details, see \insertCite{engle_ghysels_sohn_2013;textual}{rumidas} and \insertCite{conrad_lock_2015;textual}{rumidas}. 30 | } 31 | \examples{ 32 | \donttest{ 33 | # conditional density of the innovations: normal 34 | start_val<-c(alpha=0.01,beta=0.8,m=0,theta=0.1,w2=2) 35 | r_t<-sp500['2005/2010'] 36 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 37 | sum(GM_loglik_no_skew(start_val,r_t,mv_m,K=12,distribution="norm")) 38 | 39 | # conditional density of the innovations: Student-t 40 | start_val<-c(alpha=0.01,beta=0.8,m=0,theta=0.1,w2=2,shape=5) 41 | r_t<-sp500['2005/2010'] 42 | mv_m<-mv_into_mat(r_t,indpro,K=12,"monthly") 43 | sum(GM_loglik_no_skew(start_val,r_t,mv_m,K=12,distribution="std")) 44 | } 45 | } 46 | \references{ 47 | \insertAllCited{} 48 | } 49 | \seealso{ 50 | \code{\link{mv_into_mat}}. 51 | } 52 | \keyword{internal} 53 | -------------------------------------------------------------------------------- /man/GM_long_run_vol.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{GM_long_run_vol} 4 | \alias{GM_long_run_vol} 5 | \title{GARCH-MIDAS (daily) long-run (with skewness)} 6 | \usage{ 7 | GM_long_run_vol(param, daily_ret, mv_m, K, lag_fun = "Beta") 8 | } 9 | \arguments{ 10 | \item{param}{Vector of estimated values.} 11 | 12 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 13 | 14 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 15 | 16 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 17 | 18 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 19 | for the Beta and Exponential Almon lag functions, respectively.} 20 | } 21 | \value{ 22 | The resulting vector is an "xts" object representing the conditional volatility. 23 | } 24 | \description{ 25 | Obtains the estimated daily long-run volatility for the GARCH-MIDAS model, with an asymmetric term linked to past negative returns. 26 | For details, see \insertCite{engle_ghysels_sohn_2013;textual}{rumidas} and \insertCite{conrad_lock_2015;textual}{rumidas}. 27 | } 28 | \examples{ 29 | \donttest{ 30 | # estimated volatility 31 | est_val<-c(alpha=0.01,beta=0.8,gamma=0.05,m=2,theta=0.1,w2=2) 32 | r_t<-sp500['/2010'] 33 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 34 | head(GM_long_run_vol(est_val,r_t,mv_m,K=12)) 35 | } 36 | } 37 | \references{ 38 | \insertAllCited{} 39 | } 40 | \seealso{ 41 | \code{\link{mv_into_mat}}. 42 | } 43 | \keyword{internal} 44 | -------------------------------------------------------------------------------- /man/GM_long_run_vol_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{GM_long_run_vol_no_skew} 4 | \alias{GM_long_run_vol_no_skew} 5 | \title{GARCH-MIDAS (daily) long-run volatility (without skewness)} 6 | \usage{ 7 | GM_long_run_vol_no_skew(param, daily_ret, mv_m, K, lag_fun = "Beta") 8 | } 9 | \arguments{ 10 | \item{param}{Vector of estimated values.} 11 | 12 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 13 | 14 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 15 | 16 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 17 | 18 | \item{lag_fun}{\strong{optional}. Lag function to use. Valid choices are "Beta" (by default) and "Almon", 19 | for the Beta and Exponential Almon lag functions, respectively.} 20 | } 21 | \value{ 22 | The resulting vector is an "xts" object representing the conditional volatility. 23 | } 24 | \description{ 25 | Obtains the daily long-run volatility for the GARCH-MIDAS model, without the skewness parameter in the short-run.. 26 | For details, see \insertCite{engle_ghysels_sohn_2013;textual}{rumidas} and \insertCite{conrad_lock_2015;textual}{rumidas}. 27 | } 28 | \examples{ 29 | \donttest{ 30 | est_val<-c(alpha=0.01,beta=0.8,m=2,theta=0.1,w2=2) 31 | r_t<-sp500['/2010'] 32 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 33 | head(GM_long_run_vol_no_skew(est_val,r_t,mv_m,K=12)) 34 | } 35 | } 36 | \references{ 37 | \insertAllCited{} 38 | } 39 | \seealso{ 40 | \code{\link{mv_into_mat}}. 41 | } 42 | \keyword{internal} 43 | -------------------------------------------------------------------------------- /man/Inf_criteria.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/functions.R 3 | \name{Inf_criteria} 4 | \alias{Inf_criteria} 5 | \title{Information Criteria} 6 | \usage{ 7 | Inf_criteria(est) 8 | } 9 | \arguments{ 10 | \item{est}{The output of the estimation process.} 11 | } 12 | \value{ 13 | The resulting vector represents the AIC and BIC criteria. 14 | } 15 | \description{ 16 | Returns the Akaike and Bayesian information criteria. 17 | } 18 | \keyword{internal} 19 | -------------------------------------------------------------------------------- /man/LF_f.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/functions.R 3 | \name{LF_f} 4 | \alias{LF_f} 5 | \title{Loss functions} 6 | \usage{ 7 | LF_f(vol_est, vol_proxy) 8 | } 9 | \arguments{ 10 | \item{vol_est}{It is the estimated volatility.} 11 | 12 | \item{vol_proxy}{It is the volatility proxy.} 13 | } 14 | \value{ 15 | The resulting vector represents the MSE and QLIKE averages. 16 | } 17 | \description{ 18 | Returns the MSE and QLIKE. 19 | } 20 | \keyword{internal} 21 | -------------------------------------------------------------------------------- /man/MEM_MIDAS_X_loglik.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{MEM_MIDAS_X_loglik} 4 | \alias{MEM_MIDAS_X_loglik} 5 | \title{MEM-MIDAS-X log-likelihood (with skewness parameter)} 6 | \usage{ 7 | MEM_MIDAS_X_loglik(param, x, daily_ret, mv_m, K, z) 8 | } 9 | \arguments{ 10 | \item{param}{Vector of starting values} 11 | 12 | \item{x}{Dependent variable, usually the realized volatility. It must be positive and "xts" object} 13 | 14 | \item{daily_ret}{Daily returns, which must be an "xts" object, and with the same length of x} 15 | 16 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function} 17 | 18 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider} 19 | 20 | \item{z}{Additional daily variable which must be an "xts" object, and with the same length of x} 21 | } 22 | \value{ 23 | The resulting vector is the log-likelihood value for each \eqn{i,t} 24 | } 25 | \description{ 26 | Obtains the log-likelihood of the MEM-MIDAS-X, with an asymmetric term linked to past negative returns and an additional 27 | X part (for instance, the VIX). 28 | } 29 | \examples{ 30 | \donttest{ 31 | start_val<-c(alpha=0.10,beta=0.8,gamma=0.1,m=0,theta=-0.16,w2=5,delta=0.1) 32 | r_t<-sp500['2010'] 33 | real<-(rv5['2010'])^0.5 # realized volatility 34 | mv_m<-mv_into_mat(real,diff(indpro),K=12,"monthly") 35 | sum(MEM_MIDAS_X_loglik(start_val,real,r_t,mv_m,K=12,z=vix['2010'])) 36 | } 37 | } 38 | \references{ 39 | \insertAllCited{} 40 | } 41 | \seealso{ 42 | \code{\link{mv_into_mat}}. 43 | } 44 | \keyword{internal} 45 | -------------------------------------------------------------------------------- /man/MEM_MIDAS_X_loglik_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{MEM_MIDAS_X_loglik_no_skew} 4 | \alias{MEM_MIDAS_X_loglik_no_skew} 5 | \title{MEM-MIDAS-X log-likelihood (no skewness parameter)} 6 | \usage{ 7 | MEM_MIDAS_X_loglik_no_skew(param, x, mv_m, K, z) 8 | } 9 | \arguments{ 10 | \item{param}{Vector of starting values} 11 | 12 | \item{x}{Dependent variable, usually the realized volatility. It must be positive and "xts" object} 13 | 14 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function} 15 | 16 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider} 17 | 18 | \item{z}{Additional daily variable which must be an "xts" object, and with the same length of x} 19 | } 20 | \value{ 21 | The resulting vector is the log-likelihood value for each \eqn{i,t} 22 | } 23 | \description{ 24 | Obtains the log-likelihood of the MEM-MIDAS-X, with an additional X part (for instance, the VIX). 25 | } 26 | \examples{ 27 | \donttest{ 28 | start_val<-c(alpha=0.10,beta=0.8,m=0,theta=-0.16,w2=5,delta=0.1) 29 | real<-(rv5['2010'])^0.5 # realized volatility 30 | mv_m<-mv_into_mat(real,diff(indpro),K=12,"monthly") 31 | sum(MEM_MIDAS_X_loglik_no_skew(start_val,real,mv_m,K=12,z=vix['2010'])) 32 | } 33 | } 34 | \references{ 35 | \insertAllCited{} 36 | } 37 | \seealso{ 38 | \code{\link{mv_into_mat}}. 39 | } 40 | \keyword{internal} 41 | -------------------------------------------------------------------------------- /man/MEM_MIDAS_X_lr_pred.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{MEM_MIDAS_X_lr_pred} 4 | \alias{MEM_MIDAS_X_lr_pred} 5 | \title{MEM-MIDAS-X long-run one-step-ahead predictions (with skewness parameter)} 6 | \usage{ 7 | MEM_MIDAS_X_lr_pred(param, x, daily_ret, mv_m, K, z) 8 | } 9 | \arguments{ 10 | \item{param}{Vector of starting values} 11 | 12 | \item{x}{Dependent variable, usually the realized volatility. It must be positive and "xts" object} 13 | 14 | \item{daily_ret}{Daily returns, which must be an "xts" object, and with the same length of x} 15 | 16 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function} 17 | 18 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider} 19 | 20 | \item{z}{Additional daily variable which must be an "xts" object, and with the same length of x} 21 | } 22 | \value{ 23 | The resulting vector is the log-likelihood value for each \eqn{i,t} 24 | } 25 | \description{ 26 | Predicts the long-run term of the dependent variable, usually the realized volatility, for the MEM-MIDAS-X, 27 | with an asymmetric term linked to past negative returns and an additional X part (for instance, the VIX). 28 | } 29 | \references{ 30 | \insertAllCited{} 31 | } 32 | \seealso{ 33 | \code{\link{mv_into_mat}}. 34 | } 35 | \keyword{internal} 36 | -------------------------------------------------------------------------------- /man/MEM_MIDAS_X_lr_pred_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{MEM_MIDAS_X_lr_pred_no_skew} 4 | \alias{MEM_MIDAS_X_lr_pred_no_skew} 5 | \title{MEM-MIDAS-X long-run one-step-ahead predictions (no skewness parameter)} 6 | \usage{ 7 | MEM_MIDAS_X_lr_pred_no_skew(param, x, mv_m, K, z) 8 | } 9 | \arguments{ 10 | \item{param}{Vector of starting values} 11 | 12 | \item{x}{Dependent variable, usually the realized volatility. It must be positive and "xts" object} 13 | 14 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function} 15 | 16 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider} 17 | 18 | \item{z}{Additional daily variable which must be an "xts" object, and with the same length of x} 19 | } 20 | \value{ 21 | The resulting vector is the log-likelihood value for each \eqn{i,t} 22 | } 23 | \description{ 24 | Predicts the long-run term of the dependent variable, usually the realized volatility, for the MEM-MIDAS-X, with an additional X part (for instance, the VIX). 25 | } 26 | \references{ 27 | \insertAllCited{} 28 | } 29 | \seealso{ 30 | \code{\link{mv_into_mat}}. 31 | } 32 | \keyword{internal} 33 | -------------------------------------------------------------------------------- /man/MEM_MIDAS_X_pred.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{MEM_MIDAS_X_pred} 4 | \alias{MEM_MIDAS_X_pred} 5 | \title{MEM-MIDAS-X one-step-ahead predictions (with skewness parameter)} 6 | \usage{ 7 | MEM_MIDAS_X_pred(param, x, daily_ret, mv_m, K, z) 8 | } 9 | \arguments{ 10 | \item{param}{Vector of starting values} 11 | 12 | \item{x}{Dependent variable, usually the realized volatility. It must be positive and "xts" object} 13 | 14 | \item{daily_ret}{Daily returns, which must be an "xts" object, and with the same length of x} 15 | 16 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function} 17 | 18 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider} 19 | 20 | \item{z}{Additional daily variable which must be an "xts" object, and with the same length of x} 21 | } 22 | \value{ 23 | The resulting vector is the log-likelihood value for each \eqn{i,t} 24 | } 25 | \description{ 26 | Predicts the dependent variable, usually the realized volatility, for the MEM-MIDAS-X, with an asymmetric term linked to past negative returns and 27 | an additional X part (for instance, the VIX). 28 | } 29 | \references{ 30 | \insertAllCited{} 31 | } 32 | \seealso{ 33 | \code{\link{mv_into_mat}}. 34 | } 35 | \keyword{internal} 36 | -------------------------------------------------------------------------------- /man/MEM_MIDAS_X_pred_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{MEM_MIDAS_X_pred_no_skew} 4 | \alias{MEM_MIDAS_X_pred_no_skew} 5 | \title{MEM-MIDAS-X one-step-ahead predictions (no skewness parameter)} 6 | \usage{ 7 | MEM_MIDAS_X_pred_no_skew(param, x, mv_m, K, z) 8 | } 9 | \arguments{ 10 | \item{param}{Vector of starting values} 11 | 12 | \item{x}{Dependent variable, usually the realized volatility. It must be positive and "xts" object} 13 | 14 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function} 15 | 16 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider} 17 | 18 | \item{z}{Additional daily variable which must be an "xts" object, and with the same length of x} 19 | } 20 | \value{ 21 | The resulting vector is the log-likelihood value for each \eqn{i,t} 22 | } 23 | \description{ 24 | Predicts the dependent variable, usually the realized volatility, for the MEM-MIDAS-X, with an additional X part (for instance, the VIX). 25 | } 26 | \references{ 27 | \insertAllCited{} 28 | } 29 | \seealso{ 30 | \code{\link{mv_into_mat}}. 31 | } 32 | \keyword{internal} 33 | -------------------------------------------------------------------------------- /man/MEM_MIDAS_loglik.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{MEM_MIDAS_loglik} 4 | \alias{MEM_MIDAS_loglik} 5 | \title{MEM-MIDAS log-likelihood (with skewness parameter)} 6 | \usage{ 7 | MEM_MIDAS_loglik(param, x, daily_ret, mv_m, K) 8 | } 9 | \arguments{ 10 | \item{param}{Vector of starting values.} 11 | 12 | \item{x}{Dependent variable, usually the realized volatility. It must be positive and "xts" object.} 13 | 14 | \item{daily_ret}{Daily returns, which must be an "xts" object, and with the same length of x.} 15 | 16 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 17 | 18 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 19 | } 20 | \value{ 21 | The resulting vector is the log-likelihood value for each \eqn{i,t}. 22 | } 23 | \description{ 24 | Obtains the log-likelihood of the MEM-MIDAS, with an asymmetric term linked to past negative returns. 25 | } 26 | \examples{ 27 | \donttest{ 28 | start_val<-c(alpha=0.10,beta=0.8,gamma=0.1,m=0,theta=-0.16,w2=5) 29 | r_t<-sp500['/2010'] 30 | real<-(rv5['/2010'])^0.5 # realized volatility 31 | mv_m<-mv_into_mat(real,diff(indpro),K=12,"monthly") 32 | sum(MEM_MIDAS_loglik(start_val,real,r_t,mv_m,K=12)) 33 | } 34 | } 35 | \references{ 36 | \insertAllCited{} 37 | } 38 | \seealso{ 39 | \code{\link{mv_into_mat}}. 40 | } 41 | \keyword{internal} 42 | -------------------------------------------------------------------------------- /man/MEM_MIDAS_loglik_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{MEM_MIDAS_loglik_no_skew} 4 | \alias{MEM_MIDAS_loglik_no_skew} 5 | \title{MEM-MIDAS log-likelihood (no skewness parameter)} 6 | \usage{ 7 | MEM_MIDAS_loglik_no_skew(param, x, mv_m, K) 8 | } 9 | \arguments{ 10 | \item{param}{Vector of starting values} 11 | 12 | \item{x}{Dependent variable, usually the realized volatility. It must be positive and "xts" object} 13 | 14 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function} 15 | 16 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider} 17 | } 18 | \value{ 19 | The resulting vector is the log-likelihood value for each \eqn{i,t} 20 | } 21 | \description{ 22 | Obtains the log-likelihood of the MEM-MIDAS. 23 | } 24 | \examples{ 25 | \donttest{ 26 | start_val<-c(alpha=0.10,beta=0.8,m=0,theta=-0.16,w2=5) 27 | real<-(rv5['/2010'])^0.5 # realized volatility 28 | mv_m<-mv_into_mat(real,diff(indpro),K=12,"monthly") 29 | sum(MEM_MIDAS_loglik_no_skew(start_val,real,mv_m,K=12)) 30 | } 31 | } 32 | \references{ 33 | \insertAllCited{} 34 | } 35 | \seealso{ 36 | \code{\link{mv_into_mat}}. 37 | } 38 | \keyword{internal} 39 | -------------------------------------------------------------------------------- /man/MEM_MIDAS_lr_pred.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{MEM_MIDAS_lr_pred} 4 | \alias{MEM_MIDAS_lr_pred} 5 | \title{MEM-MIDAS long-run one-step-ahead predictions (with skewness parameter)} 6 | \usage{ 7 | MEM_MIDAS_lr_pred(param, x, daily_ret, mv_m, K) 8 | } 9 | \arguments{ 10 | \item{param}{Vector of estimated values. It must be a six--dimensional vector. See the example below.} 11 | 12 | \item{x}{Dependent variable, usually the realized volatility. It must be positive and "xts" object.} 13 | 14 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 15 | 16 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 17 | 18 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 19 | } 20 | \value{ 21 | The resulting vector is the log-likelihood value for each \eqn{i,t}. 22 | } 23 | \description{ 24 | Predicts the long-run term of the dependent variable, usually the realized volatility, for the MEM-MIDAS, with an asymmetric term linked to past negative returns. 25 | } 26 | \examples{ 27 | \donttest{ 28 | est_val<-c(alpha=0.10,beta=0.8,gamma=0.1,m=0,theta=-0.16,w2=5) 29 | r_t<-sp500['/2010'] 30 | real<-(rv5['/2010'])^0.5 # realized volatility 31 | mv_m<-mv_into_mat(real,diff(indpro),K=12,"monthly") 32 | est_vol<-MEM_MIDAS_pred(est_val,real,r_t,mv_m,K=12) 33 | head(est_vol) 34 | } 35 | } 36 | \references{ 37 | \insertAllCited{} 38 | } 39 | \seealso{ 40 | \code{\link{mv_into_mat}}. 41 | } 42 | \keyword{internal} 43 | -------------------------------------------------------------------------------- /man/MEM_MIDAS_lr_pred_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{MEM_MIDAS_lr_pred_no_skew} 4 | \alias{MEM_MIDAS_lr_pred_no_skew} 5 | \title{MEM-MIDAS long-run one-step-ahead predictions (no skewness parameter)} 6 | \usage{ 7 | MEM_MIDAS_lr_pred_no_skew(param, x, mv_m, K) 8 | } 9 | \arguments{ 10 | \item{param}{Vector of starting values.} 11 | 12 | \item{x}{Dependent variable, usually the realized volatility. It must be positive and "xts" object.} 13 | 14 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 15 | 16 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 17 | } 18 | \value{ 19 | The resulting vector is the log-likelihood value for each \eqn{i,t}. 20 | } 21 | \description{ 22 | Predicts the long-run term of the dependent variable, usually the realized volatility, for the MEM-MIDAS. 23 | } 24 | \examples{ 25 | \donttest{ 26 | est_val<-c(alpha=0.10,beta=0.8,m=0,theta=-0.16,w2=5) 27 | real<-(rv5['/2010'])^0.5 # realized volatility 28 | mv_m<-mv_into_mat(real,diff(indpro),K=12,"monthly") 29 | sum(MEM_MIDAS_lr_pred_no_skew(est_val,real,mv_m,K=12)) 30 | } 31 | } 32 | \references{ 33 | \insertAllCited{} 34 | } 35 | \seealso{ 36 | \code{\link{mv_into_mat}}. 37 | } 38 | \keyword{internal} 39 | -------------------------------------------------------------------------------- /man/MEM_MIDAS_pred.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{MEM_MIDAS_pred} 4 | \alias{MEM_MIDAS_pred} 5 | \title{MEM-MIDAS one-step-ahead predictions (with skewness parameter)} 6 | \usage{ 7 | MEM_MIDAS_pred(param, x, daily_ret, mv_m, K) 8 | } 9 | \arguments{ 10 | \item{param}{Vector of estimated values. It must be a six--dimensional vector. See the example below.} 11 | 12 | \item{x}{Dependent variable, usually the realized volatility. It must be positive and "xts" object.} 13 | 14 | \item{daily_ret}{Daily returns, which must be an "xts" object.} 15 | 16 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 17 | 18 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 19 | } 20 | \value{ 21 | The resulting vector is the one-step-ahead prediction for each \eqn{i,t}. 22 | } 23 | \description{ 24 | Predicts the dependent variable, usually the realized volatility, for the MEM-MIDAS, with an asymmetric term linked to past negative returns. 25 | } 26 | \examples{ 27 | \donttest{ 28 | est_val<-c(alpha=0.10,beta=0.8,gamma=0.1,m=0,theta=-0.16,w2=5) 29 | r_t<-sp500['/2010'] 30 | real<-rv5['/2010']^0.5 # realized volatility 31 | mv_m<-mv_into_mat(real,diff(indpro),K=12,"monthly") 32 | est_vol<-MEM_MIDAS_pred(est_val,real,r_t,mv_m,K=12) 33 | head(est_vol) 34 | } 35 | } 36 | \references{ 37 | \insertAllCited{} 38 | } 39 | \seealso{ 40 | \code{\link{mv_into_mat}}. 41 | } 42 | \keyword{internal} 43 | -------------------------------------------------------------------------------- /man/MEM_MIDAS_pred_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{MEM_MIDAS_pred_no_skew} 4 | \alias{MEM_MIDAS_pred_no_skew} 5 | \title{MEM-MIDAS one-step-ahead predictions (no skewness parameter)} 6 | \usage{ 7 | MEM_MIDAS_pred_no_skew(param, x, mv_m, K) 8 | } 9 | \arguments{ 10 | \item{param}{Vector of starting values.} 11 | 12 | \item{x}{Dependent variable, usually the realized volatility. It must be positive and "xts" object.} 13 | 14 | \item{mv_m}{MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function.} 15 | 16 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 17 | } 18 | \value{ 19 | The resulting vector is the one-step-ahead prediction for each \eqn{i,t}. 20 | } 21 | \description{ 22 | Predicts the dependent variable, usually the realized volatility, for the MEM-MIDAS. 23 | } 24 | \examples{ 25 | \donttest{ 26 | est_val<-c(alpha=0.10,beta=0.8,m=0,theta=-0.16,w2=5) 27 | real<-(rv5['/2010'])^0.5 # realized volatility 28 | mv_m<-mv_into_mat(real,diff(indpro),K=12,"monthly") 29 | sum(MEM_MIDAS_pred_no_skew(est_val,real,mv_m,K=12)) 30 | } 31 | } 32 | \references{ 33 | \insertAllCited{} 34 | } 35 | \seealso{ 36 | \code{\link{mv_into_mat}}. 37 | } 38 | \keyword{internal} 39 | -------------------------------------------------------------------------------- /man/MEM_QMLE_sd.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/functions.R 3 | \name{MEM_QMLE_sd} 4 | \alias{MEM_QMLE_sd} 5 | \title{Standard errors for the Quasi Maximum Likelihood estimator of the MEM-based models} 6 | \usage{ 7 | MEM_QMLE_sd(est, x, x_pred) 8 | } 9 | \arguments{ 10 | \item{est}{It is the output of the maximum likelihood estimation process.} 11 | } 12 | \value{ 13 | The resulting vector represents the QML standard errors. 14 | } 15 | \description{ 16 | Obtains the standard errors for the Quasi Maximum Likelihood (QML) estimator. 17 | } 18 | \keyword{internal} 19 | -------------------------------------------------------------------------------- /man/MEM_X_loglik.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{MEM_X_loglik} 4 | \alias{MEM_X_loglik} 5 | \title{MEM-X log-likelihood (with skewness parameter)} 6 | \usage{ 7 | MEM_X_loglik(param, x, daily_ret, z) 8 | } 9 | \arguments{ 10 | \item{param}{Vector of starting values.} 11 | 12 | \item{x}{Dependent variable, usually the realized volatility. It must be positive and "xts" object.} 13 | 14 | \item{daily_ret}{Daily returns, which must be an "xts" object, and with the same length of x.} 15 | 16 | \item{z}{Additional daily variable which must be an "xts" object, and with the same length of x.} 17 | } 18 | \value{ 19 | The resulting vector is the log-likelihood value for each \eqn{i,t}. 20 | } 21 | \description{ 22 | Obtains the log-likelihood of the base MEM, with an asymmetric term linked to past negative returns and an additional 23 | X part (for instance, the VIX). 24 | } 25 | \examples{ 26 | \donttest{ 27 | start_val<-c(alpha=0.10,beta=0.8,gamma=0.05,delta=0.01) 28 | real<-(rv5['2009/2010'])^0.5 # realized volatility 29 | r_t<-sp500['2009/2010'] 30 | z<-vix['2009/2010'] 31 | sum(MEM_X_loglik(start_val,real,r_t,z)) 32 | } 33 | } 34 | \references{ 35 | \insertAllCited{} 36 | } 37 | \keyword{internal} 38 | -------------------------------------------------------------------------------- /man/MEM_X_loglik_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{MEM_X_loglik_no_skew} 4 | \alias{MEM_X_loglik_no_skew} 5 | \title{MEM-X log-likelihood (no skewness parameter)} 6 | \usage{ 7 | MEM_X_loglik_no_skew(param, x, z) 8 | } 9 | \arguments{ 10 | \item{param}{Vector of starting values.} 11 | 12 | \item{x}{Dependent variable, usually the realized volatility. It must be positive and "xts" object.} 13 | 14 | \item{z}{Additional daily variable which must be an "xts" object, and with the same length of x.} 15 | } 16 | \value{ 17 | The resulting vector is the log-likelihood value for each \eqn{i,t}. 18 | } 19 | \description{ 20 | Obtains the log-likelihood of the base MEM, with an additional X part (for instance, the VIX). 21 | } 22 | \examples{ 23 | \donttest{ 24 | start_val<-c(alpha=0.10,beta=0.8,delta=0.01) 25 | real<-(rv5['2009/2010'])^0.5 # realized volatility 26 | z<-vix['2009/2010'] 27 | sum(MEM_X_loglik_no_skew(start_val,real,z)) 28 | } 29 | } 30 | \references{ 31 | \insertAllCited{} 32 | } 33 | \keyword{internal} 34 | -------------------------------------------------------------------------------- /man/MEM_X_pred.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{MEM_X_pred} 4 | \alias{MEM_X_pred} 5 | \title{MEM-X one-step-ahead predictions (with skewness parameter)} 6 | \usage{ 7 | MEM_X_pred(param, x, daily_ret, z) 8 | } 9 | \arguments{ 10 | \item{param}{Vector of estimated values.} 11 | 12 | \item{x}{Dependent variable, usually the realized volatility. It must be positive and "xts" object.} 13 | 14 | \item{daily_ret}{Daily returns, which must be an "xts" object, and with the same length of x.} 15 | 16 | \item{z}{Additional daily variable which must be an "xts" object, and with the same length of x.} 17 | } 18 | \value{ 19 | The resulting vector is the log-likelihood value for each \eqn{i,t}. 20 | } 21 | \description{ 22 | Predicts the dependent variable, usually the realized volatility, for the base MEM, with an asymmetric term 23 | linked to past negative returns and an additional X part (for instance, the VIX). 24 | } 25 | \references{ 26 | \insertAllCited{} 27 | } 28 | \keyword{internal} 29 | -------------------------------------------------------------------------------- /man/MEM_X_pred_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{MEM_X_pred_no_skew} 4 | \alias{MEM_X_pred_no_skew} 5 | \title{MEM-X one-step-ahead predictions (no skewness parameter)} 6 | \usage{ 7 | MEM_X_pred_no_skew(param, x, z) 8 | } 9 | \arguments{ 10 | \item{param}{Vector of estimated values.} 11 | 12 | \item{x}{Dependent variable, usually the realized volatility. It must be positive and "xts" object.} 13 | 14 | \item{z}{Additional daily variable which must be an "xts" object, and with the same length of x.} 15 | } 16 | \value{ 17 | The resulting vector is the log-likelihood value for each \eqn{i,t}. 18 | } 19 | \description{ 20 | Predicts the dependent variable, usually the realized volatility, for the base MEM, with an additional X part (for instance, the VIX). 21 | } 22 | \references{ 23 | \insertAllCited{} 24 | } 25 | \keyword{internal} 26 | -------------------------------------------------------------------------------- /man/MEM_loglik.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{MEM_loglik} 4 | \alias{MEM_loglik} 5 | \title{MEM log-likelihood (with skewness parameter)} 6 | \usage{ 7 | MEM_loglik(param, x, daily_ret) 8 | } 9 | \arguments{ 10 | \item{param}{Vector of starting values.} 11 | 12 | \item{x}{Dependent variable, usually the realized volatility. It must be positive and "xts" object.} 13 | 14 | \item{daily_ret}{Daily returns, which must be an "xts" object, and with the same length of x.} 15 | } 16 | \value{ 17 | The resulting vector is the log-likelihood value for each \eqn{i,t}. 18 | } 19 | \description{ 20 | Obtains the log-likelihood of the base MEM, with an asymmetric term linked to past negative returns. 21 | For details, see \insertCite{engle_gallo_2006;textual}{rumidas}. 22 | } 23 | \examples{ 24 | \donttest{ 25 | start_val<-c(alpha=0.10,beta=0.8,gamma=0.05) 26 | real<-(rv5['/2010'])^0.5 # realized volatility 27 | r_t<-sp500['/2010'] 28 | sum(MEM_loglik(start_val,real,r_t)) 29 | } 30 | } 31 | \references{ 32 | \insertAllCited{} 33 | } 34 | \keyword{internal} 35 | -------------------------------------------------------------------------------- /man/MEM_loglik_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{MEM_loglik_no_skew} 4 | \alias{MEM_loglik_no_skew} 5 | \title{MEM log-likelihood (no skewness parameter)} 6 | \usage{ 7 | MEM_loglik_no_skew(param, x) 8 | } 9 | \arguments{ 10 | \item{param}{Vector of starting values.} 11 | 12 | \item{x}{Dependent variable, usually the realized volatility. It must be positive and "xts" object.} 13 | } 14 | \value{ 15 | The resulting vector is the log-likelihood value for each \eqn{i,t}. 16 | } 17 | \description{ 18 | Obtains the log-likelihood of the base MEM. 19 | For details, see \insertCite{engle_gallo_2006;textual}{rumidas}. 20 | } 21 | \examples{ 22 | \donttest{ 23 | start_val<-c(alpha=0.10,beta=0.8) 24 | real<-(rv5['/2010'])^0.5 # realized volatility 25 | sum(MEM_loglik_no_skew(start_val,real)) 26 | } 27 | } 28 | \references{ 29 | \insertAllCited{} 30 | } 31 | \keyword{internal} 32 | -------------------------------------------------------------------------------- /man/MEM_pred.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{MEM_pred} 4 | \alias{MEM_pred} 5 | \title{MEM one-step-ahead predictions (with skewness parameter)} 6 | \usage{ 7 | MEM_pred(param, x, daily_ret) 8 | } 9 | \arguments{ 10 | \item{param}{Vector of estimated values.} 11 | 12 | \item{x}{Dependent variable, usually the realized volatility. It must be positive and "xts" object.} 13 | 14 | \item{daily_ret}{Daily returns, which must be an "xts" object, and with the same length of x.} 15 | } 16 | \value{ 17 | The resulting vector is the one-step-ahead prediction for each \eqn{i,t}. 18 | } 19 | \description{ 20 | Predicts the dependent variable, usually the realized volatility, for the base MEM, with an asymmetric term linked to past negative returns. 21 | For details, see \insertCite{engle_gallo_2006;textual}{rumidas}. 22 | } 23 | \examples{ 24 | \donttest{ 25 | est_val<-c(alpha=0.10,beta=0.8,gamma=0.05) 26 | real<-(rv5['/2010'])^0.5 # realized volatility 27 | r_t<-sp500['/2010'] 28 | head(MEM_pred(est_val,real,r_t)) 29 | } 30 | } 31 | \references{ 32 | \insertAllCited{} 33 | } 34 | \keyword{internal} 35 | -------------------------------------------------------------------------------- /man/MEM_pred_no_skew.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{MEM_pred_no_skew} 4 | \alias{MEM_pred_no_skew} 5 | \title{MEM one-step-ahead predictions (no skewness parameter)} 6 | \usage{ 7 | MEM_pred_no_skew(param, x) 8 | } 9 | \arguments{ 10 | \item{param}{Vector of starting values.} 11 | 12 | \item{x}{Dependent variable, usually the realized volatility. It must be positive and "xts" object.} 13 | } 14 | \value{ 15 | The resulting vector is the log-likelihood value for each \eqn{i,t}. 16 | } 17 | \description{ 18 | Predicts the dependent variable, usually the realized volatility, for the base MEM. 19 | For details, see \insertCite{engle_gallo_2006;textual}{rumidas}. 20 | } 21 | \examples{ 22 | \donttest{ 23 | est_val<-c(alpha=0.10,beta=0.8) 24 | real<-(rv5['/2010'])^0.5 # realized volatility 25 | head(MEM_pred_no_skew(est_val,real)) 26 | } 27 | } 28 | \references{ 29 | \insertAllCited{} 30 | } 31 | \keyword{internal} 32 | -------------------------------------------------------------------------------- /man/QMLE_sd.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/functions.R 3 | \name{QMLE_sd} 4 | \alias{QMLE_sd} 5 | \title{Standard errors for the Quasi Maximum Likelihood estimator of the GARCH-MIDAS-based models} 6 | \usage{ 7 | QMLE_sd(est) 8 | } 9 | \arguments{ 10 | \item{est}{It is the output of the maximum likelihood estimation process.} 11 | } 12 | \value{ 13 | The resulting vector represents the QML standard errors. 14 | } 15 | \description{ 16 | Obtains the standard errors for the Quasi Maximum Likelihood (QML) estimator. 17 | } 18 | \keyword{internal} 19 | -------------------------------------------------------------------------------- /man/beta_function.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/functions.R 3 | \name{beta_function} 4 | \alias{beta_function} 5 | \title{Beta function} 6 | \usage{ 7 | beta_function(k, K, w1, w2) 8 | } 9 | \arguments{ 10 | \item{k}{Lag of interest.} 11 | 12 | \item{K}{Number of (lagged) realizations to consider.} 13 | 14 | \item{w1, w2}{Parameters governing the weights of each \eqn{k} lag.} 15 | } 16 | \value{ 17 | The weights associated to each lag \eqn{k}, with \eqn{k=1,\cdots,K}. 18 | } 19 | \description{ 20 | Represents a tool able to accommodate various lag structures for the 21 | additional MIDAS variable observed each "low-frequency" period \eqn{t}. It can have a monotonically increasing, 22 | decreasing weighting scheme or a hump-shaped weighting scheme. The Beta function is: 23 | \deqn{\delta_k(\omega)=\frac{(k/K)^{\omega_1-1} (1-k/K)^{\omega_2-1}}{\sum_{j=1}^K (j/K)^{\omega_1-1}(1-j/K)^{\omega_2-1}}.} 24 | For additional details, see \insertCite{ghysels_2007;textual}{rumidas}. 25 | } 26 | \examples{ 27 | # suppose to have four lags: 28 | # K<-4 29 | # w1<-1 # by setting w1=1, only a monotonically decreasing weighting scheme is allowed 30 | #(more recent observations weigh more) 31 | # w2<-5 32 | beta_function(1:4,K=4,w1=1,w2=5) 33 | } 34 | \references{ 35 | \insertAllCited{} 36 | } 37 | -------------------------------------------------------------------------------- /man/exp_almon.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/functions.R 3 | \name{exp_almon} 4 | \alias{exp_almon} 5 | \title{Exponential Almon Lag} 6 | \usage{ 7 | exp_almon(k, K, w1, w2) 8 | } 9 | \arguments{ 10 | \item{k}{Lag of interest.} 11 | 12 | \item{K}{Number of (lagged) realizations to consider.} 13 | 14 | \item{w1, w2}{Parameters governing the weights of each \eqn{k} lag.} 15 | } 16 | \value{ 17 | The weights associated to each lag \eqn{k}, with \eqn{k=1,\cdots,K}. 18 | } 19 | \description{ 20 | Represents a tool able to accommodate various lag structures for the 21 | additional MIDAS variable observed each "low-frequency" period \eqn{t}. It can have a monotonically increasing, 22 | decreasing weighting scheme or a hump-shaped weighting scheme. As in \insertCite{ghysels_2007;textual}{rumidas}, 23 | here the function form uses only two parameters: 24 | \deqn{\delta_k(\omega_1, \omega_2) = \frac{exp(\omega_{1}k + \omega_2 k^2)}{\sum_{k=1}^K exp(\omega_1 k + \omega_2 k^2)}.} 25 | For additional details, see \insertCite{almon_1965;textual}{rumidas} and \insertCite{ghysels_2007;textual}{rumidas}. 26 | } 27 | \examples{ 28 | # suppose to have four lags: 29 | # K<-4 # Note: the number of lags to consider 30 | # w1<-1 31 | # w2<- -0.5 # by setting w2<0, the monotonically decreasing weighting scheme is used 32 | exp_almon(1:4,K=4,w1=0.1,w2=-0.5) 33 | } 34 | \references{ 35 | \insertAllCited{} 36 | } 37 | -------------------------------------------------------------------------------- /man/indpro.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data.R 3 | \docType{data} 4 | \name{indpro} 5 | \alias{indpro} 6 | \title{Monthly U.S. Industrial Production} 7 | \format{ 8 | An object of class \code{"xts"}. 9 | } 10 | \source{ 11 | Archive of the Federal Reserve Economic Data \href{https://fred.stlouisfed.org/series/INDPRO}{(FRED)} 12 | } 13 | \usage{ 14 | data(indpro) 15 | } 16 | \description{ 17 | Monthly data on the U.S. Industrial Production index (IP, index 2012=100, seasonally adjusted) collected from the 18 | Federal Reserve Economic Data (FRED) archive. The IP has been used as MIDAS term in different contributions 19 | (see, for instance, \insertCite{engle_ghysels_sohn_2013;textual}{rumidas}, \insertCite{conrad_lock_2015;textual}{rumidas}, and 20 | \insertCite{amendola_candila_scognamillo_2017;textual}{rumidas}). 21 | } 22 | \examples{ 23 | head(indpro) 24 | summary(indpro) 25 | plot(indpro) 26 | } 27 | \references{ 28 | \insertAllCited{} 29 | } 30 | \keyword{datasets} 31 | -------------------------------------------------------------------------------- /man/multi_step_ahead_pred.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/functions.R 3 | \name{multi_step_ahead_pred} 4 | \alias{multi_step_ahead_pred} 5 | \title{Multi--step--ahead predictions of the GARCH--MIDAS--based models with and without the '--X' part.} 6 | \usage{ 7 | multi_step_ahead_pred(est, h, X = NULL) 8 | } 9 | \arguments{ 10 | \item{est}{The estimation object as resulting by the \code{\link{ugmfit}} function} 11 | 12 | \item{h}{The length of the multi-step-ahead predictions} 13 | 14 | \item{X}{\strong{optional}. The '--X' variable. NULL by default. It hat to be equal to the 'X' used in the \code{\link{ugmfit}} function} 15 | } 16 | \value{ 17 | The multi-step-ahead predictions, for the following h days, starting from the last day of the 18 | chosen in-sample period adopted in the 'est' object. 19 | } 20 | \description{ 21 | Calculates the multi--step--ahead predictions for the GARCH--MIDAS and DAGM models, according to the procedure 22 | suggested by \insertCite{amendola_candila_gallo_2020;textual}{rumidas}. 23 | } 24 | \details{ 25 | The multi--step--ahead procedure calculates the volatility predictions keeping fixed the information set at the last 26 | observation available and projecting forward the forecasts. The procedure calculates the volatility predictions conditionally 27 | to the parameters estimated in the in-sample period. Therefore, the estimation object (through the \code{\link{ugmfit}} function) 28 | has to be provided. For additional details, see Eq. (20) in \insertCite{amendola_candila_gallo_2020;textual}{rumidas}. 29 | } 30 | \examples{ 31 | \donttest{ 32 | r_t<-sp500['2008'] 33 | X<-(rv5['2008'])^0.5 34 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 35 | fit<-ugmfit(model="GMX",skew="YES",distribution="norm",r_t,mv_m,K=12,X=X) 36 | ### ten days predictions 37 | multi_step_ahead_pred(fit,h=10,X) 38 | } 39 | } 40 | \references{ 41 | \insertAllCited{} 42 | } 43 | -------------------------------------------------------------------------------- /man/mv_into_mat.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/functions.R 3 | \name{mv_into_mat} 4 | \alias{mv_into_mat} 5 | \title{MIDAS variable matrix transformation} 6 | \usage{ 7 | mv_into_mat(x, mv, K, type) 8 | } 9 | \arguments{ 10 | \item{x}{Variable according to which the MIDAS term has to be aligned. It must be an 'xts' object.} 11 | 12 | \item{mv}{MIDAS variable, observed each period \eqn{t}. It must be an 'xts' object.} 13 | 14 | \item{K}{Number of (lagged) realizations of the MIDAS variable to consider.} 15 | 16 | \item{type}{The frequency of the period of observations for the MIDAS variable. It can be 'weekly', 'monthly', 'quarterly' or 'yearly'.} 17 | } 18 | \value{ 19 | The resulting matrix has as many rows as the number of lagged realizations (plus one) of the MIDAS variable 20 | to consider, and as many columns as the length of \eqn{x}. 21 | } 22 | \description{ 23 | Implements the transformation of the MIDAS variable into a matrix, whose dimension is 24 | \eqn{(K+1) \times N}, where \eqn{K} is the number of lagged realizations to consider and 25 | \eqn{N} is the length of the variable \eqn{x}. 26 | } 27 | \examples{ 28 | \donttest{ 29 | require(xts) 30 | # weekly frequency 31 | # obtain weekly MIDAS variable after daily aggregation 32 | RV_weekly_sum<-apply.weekly(rv5^0.5,sum) #realized volatility 33 | # then allocate correctly the information 34 | RV_weekly<-as.xts(coredata(RV_weekly_sum),seq(as.Date("2000-01-10"), 35 | by = "week", length.out = length(RV_weekly_sum))) 36 | # use mv_into_mat 37 | mv_into_mat(sp500['2002/2003-12-26'],diff(RV_weekly['/2003-12']),K=4,type="weekly") 38 | 39 | # monthly frequency 40 | r_t<-sp500['2005/2010'] 41 | mv_into_mat(r_t,diff(indpro),K=12,type="monthly") 42 | 43 | # quarterly frequency 44 | RV_quarterly_sum<-apply.quarterly(rv5,sum) 45 | RV_quarterly<-as.xts(coredata(RV_quarterly_sum),seq(as.Date("2000-04-01"), 46 | by = "quarter", length.out = length(RV_quarterly_sum))) 47 | mv_into_mat(sp500['2004/2010'],diff(RV_quarterly),K=10,type="quarterly") 48 | 49 | # yearly frequency 50 | RV_yearly_sum<-apply.yearly(rv5,sum) 51 | RV_yearly<-as.xts(coredata(RV_yearly_sum),seq(as.Date("2001-01-01"), 52 | by = "year", length.out = length(RV_yearly_sum))) 53 | mv_into_mat(sp500['2006/2010'],diff(RV_yearly),K=2,type="yearly") 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /man/print.rumidas.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/functions.R 3 | \name{print.rumidas} 4 | \alias{print.rumidas} 5 | \title{Print method for 'rumidas' class} 6 | \usage{ 7 | \method{print}{rumidas}(x, ...) 8 | } 9 | \arguments{ 10 | \item{x}{An object of class 'rumidas'.} 11 | 12 | \item{...}{Further arguments passed to or from other methods.} 13 | } 14 | \description{ 15 | Print method for 'rumidas' class 16 | } 17 | \keyword{internal} 18 | -------------------------------------------------------------------------------- /man/rv5.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data.R 3 | \docType{data} 4 | \name{rv5} 5 | \alias{rv5} 6 | \title{S&P 500 realized variance at 5-minutes} 7 | \format{ 8 | An object of class \code{"xts"}. 9 | } 10 | \source{ 11 | Realized library of the Oxford-Man Institute 12 | } 13 | \usage{ 14 | data(rv5) 15 | } 16 | \description{ 17 | Daily data on the realized variance of the S&P 500 collected from the realized library of 18 | the Oxford-Man Institute \insertCite{heber_2009}{rumidas}. The realized variance has been calculated 19 | using intradaily intervals of five minutes \insertCite{andersen_boll_1998}{rumidas}. 20 | } 21 | \examples{ 22 | head(rv5) 23 | summary(rv5) 24 | plot(rv5) 25 | } 26 | \references{ 27 | \insertAllCited{} 28 | } 29 | \keyword{datasets} 30 | -------------------------------------------------------------------------------- /man/sp500.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data.R 3 | \docType{data} 4 | \name{sp500} 5 | \alias{sp500} 6 | \title{S&P 500 daily log-returns} 7 | \format{ 8 | An object of class \code{"xts"}. 9 | } 10 | \source{ 11 | Realized library of the Oxford-Man Institute 12 | } 13 | \usage{ 14 | data(sp500) 15 | } 16 | \description{ 17 | Daily data on S&P 500 collected from the realized library of 18 | the Oxford-Man Institute \insertCite{heber_2009}{rumidas}. 19 | } 20 | \examples{ 21 | head(sp500) 22 | summary(sp500) 23 | plot(sp500) 24 | } 25 | \references{ 26 | \insertAllCited{} 27 | } 28 | \keyword{datasets} 29 | -------------------------------------------------------------------------------- /man/sum_X_f.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/functions.R 3 | \name{sum_X_f} 4 | \alias{sum_X_f} 5 | \title{Summation function for the multi-step-ahead predictions of the GARCH--MIDAS models with the '--X' part.} 6 | \usage{ 7 | sum_X_f(COEF, DELTA, H) 8 | } 9 | \arguments{ 10 | \item{COEF}{The sum of the parameters \eqn{alpha}, \eqn{\beta}, and \eqn{\gamma/2}, if present.} 11 | 12 | \item{DELTA}{The AR coefficient.} 13 | 14 | \item{H}{The length of the multi-step-ahead predictions.} 15 | } 16 | \value{ 17 | The vector of the summation for each H. 18 | } 19 | \description{ 20 | For details, see Eq. (20) of \insertCite{amendola_candila_gallo_2020;textual}{rumidas}. 21 | } 22 | \references{ 23 | \insertAllCited{} 24 | } 25 | \keyword{internal} 26 | -------------------------------------------------------------------------------- /man/summary.rumidas.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/functions.R 3 | \name{summary.rumidas} 4 | \alias{summary.rumidas} 5 | \title{Summary method for 'rumidas' class} 6 | \usage{ 7 | \method{summary}{rumidas}(object, ...) 8 | } 9 | \arguments{ 10 | \item{object}{An object of class 'rumidas', that is the result of a call to \code{\link{ugmfit}} or \code{\link{umemfit}}.} 11 | 12 | \item{...}{Additional arguments affecting the summary produced.} 13 | } 14 | \description{ 15 | Summary method for 'rumidas' class 16 | } 17 | \examples{ 18 | \donttest{ 19 | r_t<-sp500['2003/2010'] 20 | real<-(rv5['2003/2010'])^0.5 # realized volatility 21 | fit<-umemfit(model="MEM",skew="NO",x=real) 22 | summary.rumidas(fit) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /man/ugmfit.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{ugmfit} 4 | \alias{ugmfit} 5 | \title{Methods for obtaining (and evaluating) a variety of GARCH-MIDAS-based models} 6 | \usage{ 7 | ugmfit( 8 | model, 9 | skew, 10 | distribution, 11 | daily_ret, 12 | mv_m, 13 | mv_m_2 = NULL, 14 | K, 15 | K_2 = NULL, 16 | lag_fun = "Beta", 17 | X = NULL, 18 | out_of_sample = NULL, 19 | vol_proxy = NULL, 20 | R = 100 21 | ) 22 | } 23 | \arguments{ 24 | \item{model}{Model to estimate. Valid choices are: "GM" for GARCH-MIDAS, "GM2M" for GARCH-MIDAS with two MIDAS variables, "GMX" for GARCH-MIDAS-X, 25 | "DAGM" for Double Asymmetric GARCH-MIDAS (DAGM), "DAGM2M" for DAGM with two MIDAS variables, and "DAGMX" for DAGM-X} 26 | 27 | \item{skew}{The skewness parameter to include in the short--run equation. Valid choices are: "YES" and "NO"} 28 | 29 | \item{distribution}{The conditional density to use for the innovations. At the moment, valid choices are "norm" and "std", 30 | for the Normal and Student-t distribution, respectively} 31 | 32 | \item{daily_ret}{Daily returns, which must be an "xts" objectparamter} 33 | 34 | \item{mv_m}{(first) MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function} 35 | 36 | \item{mv_m_2}{\strong{optional} second MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function} 37 | 38 | \item{K}{Number of (lagged) realizations of the (first) MIDAS variable to consider} 39 | 40 | \item{K_2}{\strong{optional} Number of (lagged) realizations of the (second) MIDAS variable to consider} 41 | 42 | \item{lag_fun}{\strong{optional} Lag function to use. Valid choices are "Beta" (by default) and "Almon", 43 | for the Beta and Exponential Almon lag functions, respectively} 44 | 45 | \item{X}{\strong{optional} Additional "X" variable, which must be an "xts" object. Moreover, "X" must be observed for the same days of daily_ret} 46 | 47 | \item{out_of_sample}{\strong{optional} A positive integer indicating the number of periods before the last to keep for out of sample forecasting} 48 | 49 | \item{vol_proxy}{\strong{optional} If present, the 'vol_proxy' is the volatility proxy used for the in-sample and out-of-sample (again, if present) evaluation. 50 | It could be the realized variance. If it left unspecified, vol_proxy is replaced by the squared daily returns} 51 | 52 | \item{R}{\strong{optional}. A positive integer indicating the number of replications used to find the best starting values. 53 | Equal to 100 by default} 54 | } 55 | \value{ 56 | \code{ugmfit} returns an object of class 'rumidas'. The function \code{\link{summary.rumidas}} 57 | can be used to print a summary of the results. Moreover, an object of class 'rumidas' is a list containing the following components: 58 | \itemize{ 59 | \item model: The model used for the estimation. 60 | \item rob_coef_mat: The matrix of estimated coefficients, with the QML standard errors. 61 | For details, see: \insertCite{Bollerslev_Wooldridge_1992;textual}{rumidas}. 62 | \item obs: The number of daily observations used for the (in-sample) estimation. 63 | \item period: The period of the in-sample estimation. 64 | \item loglik: The value of the log-likelihood at the maximum. 65 | \item inf_criteria: The AIC and BIC information criteria. 66 | \item loss_in_s: The in-sample MSE and QLIKE averages, calculated considering the distance with respect to the volatility proxy (if provided) or the squared daily returns. 67 | \item est_in_s: The one-step-ahead volatility, for the in-sample period, that is: \eqn{\sqrt{\hat{\tau}_t \times \hat{g}_{i,t} }}. 68 | \item est_lr_in_s: The one-step-ahead long-run volatility, for the in-sample period. 69 | \item loss_oos: The out-of-sample MSE and QLIKE averages, calculated considering the distance with respect to the volatility proxy (if provided) or the squared daily returns. 70 | \item est_oos: The one-step-ahead volatility, for the out-of-sample period, that is: \eqn{\sqrt{\hat{\tau}_t \times \hat{g}_{i,t} }}. 71 | \item est_lr_oos: The one-step-ahead long-run volatility, for the out-of-sample period. 72 | } 73 | } 74 | \description{ 75 | Estimates several GARCH-MIDAS-based models, according to two errors' conditional distributions: Normal and Student-t, and 76 | the presence of asymmetric terms in the short- and long-run components. 77 | } 78 | \details{ 79 | Function \code{ugmfit} implements the estimation and evaluation of the GARCH--MIDAS--based models, with and without the asymmetric term 80 | linked to negative lagged daily returns, according to two distributions for the error term. The general framework assumes that: 81 | \deqn{r_{i,t}= \sqrt{\tau_t \times g_{i,t} } \epsilon_{i,t},} 82 | where 83 | \itemize{ 84 | \item \eqn{r_{i,t}} is the daily return for the \eqn{i}-th day (\eqn{i = 1, \ldots, N_t}) 85 | of the period \eqn{t} (for example, a week, a month or a quarter; \eqn{t = 1 , \ldots, T}); 86 | \item \eqn{\tau_{t}} is the long-run component, varying each period \eqn{t}; 87 | \item \eqn{g_{i,t}} is the short--run term, varying each day \eqn{i} of the period \eqn{t}; 88 | \item \eqn{\epsilon_{i,t}} is an \eqn{iid} error term which has a zero mean and unit variance. 89 | } 90 | The short--run component of the GARCH--MIDAS (parameter "model" set to "GM"), DAGM (parameter "model" set to "DAGM"), and DAGM with two 91 | MIDAS variables (parameter "model" set to "DAGM2M") models is as follows. 92 | When the parameter "skew" is present (set to "YES"): 93 | \deqn{g_{i,t} = \left(1-\alpha-\gamma/2-\beta\right) + \left(\alpha + \gamma \cdot I_{\left(r_{i-1,t} < 0 \right)}\right) \frac{\left(r_{i-1,t}\right)^2}{\tau_t} + \beta g_{i-1,t},} 94 | where \eqn{I_{(\cdot)}} is an indicator function. 95 | The short--run component of the GARCH--MIDAS--X (parameter "model" set to "GMX") and DAGM--X (parameter "model" set to "DAGMX"), 96 | when the parameter "skew" is set to "YES", is: 97 | \deqn{g_{i,t} = \left(1-\alpha-\gamma/2-\beta\right) + \left(\alpha + \gamma \cdot I_{\left(r_{i-1,t} < 0 \right)}\right) \frac{\left(r_{i-1,t}\right)^2}{\tau_t} + \beta g_{i-1,t} + z \cdot \left(X_{i-1,t}- E(X_{i-1,t})\right).} 98 | When, for the models GARCH--MIDAS, GARCH--MIDAS--X, DAGM, and DAGM--X, the parameter "skew" is set to "NO", parameter \eqn{\gamma} disappears. 99 | For details on the GARCH--MIDAS--X and DAGM--X models, see \insertCite{amendola_candila_gallo_2020;textual}{rumidas}. 100 | The long-run component of the GARCH-MIDAS and GARCH--MIDAS--X models is: 101 | \deqn{\tau_{t} = \exp \left\{ m + \theta \sum_{j=1}^K \delta_{j}(\omega) X_{t-j}\right\},} 102 | where \eqn{X_{t}} is the MIDAS term and \eqn{\delta_{j}(\omega)} is the chosen weighting function, 103 | which can be the Beta (\code{\link{beta_function}}) or Exponential Almon lag (\code{\link{exp_almon}}) functions. 104 | The long-run component of the DAGM and DAGM--X models is: 105 | \deqn{\tau_t = \exp \left(m + \theta^{+} \sum_{k=1}^K \delta_k(\omega)^{+} X_{t-k} I_{\left( X_{t-k} \geq 0 \right)} + \theta^{-} \sum_{k=1}^K \delta_k(\omega)^{-} X_{t-k} I_{\left( X_{t-k} < 0 \right)} \right).} 106 | } 107 | \examples{ 108 | \donttest{ 109 | # estimate a GARH-MIDAS model, without the skewness parameter 110 | r_t<-sp500['2008'] 111 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 112 | fit<-ugmfit(model="GM",skew="NO",distribution="norm",r_t,mv_m,K=12) 113 | fit 114 | summary.rumidas(fit) 115 | names(fit) 116 | 117 | # to see the estimated coefficients with the QML standard errors: 118 | fit$rob_coef_mat 119 | 120 | # estimate a DAGM model, with the skewness parameter, 121 | # including the volatility proxy (realized variance), and 122 | # leaving the last 100 observations for the out-of-sample evaluation 123 | r_t<-sp500['2002/2020'] 124 | mv_m<-mv_into_mat(r_t,diff(indpro),K=12,"monthly") 125 | fit_2<-ugmfit(model="DAGM",skew="YES",distribution="norm",r_t, 126 | mv_m,K=12,vol_proxy=rv5['2002/2020'],out_of_sample=100) 127 | fit_2 128 | summary.rumidas(fit_2) 129 | # estimate a GM-X model, without the skewness parameter 130 | r_t<-sp500['2010/2013'] 131 | X<-vix['2010/2013'] 132 | mv_m<-mv_into_mat(r_t,diff(indpro),K=36,"monthly") 133 | fit_3<-ugmfit(model="GMX",skew="NO",distribution="norm",r_t,mv_m,K=36,X=X) 134 | summary.rumidas(fit_3) 135 | } 136 | } 137 | \references{ 138 | \insertAllCited{} 139 | } 140 | \seealso{ 141 | \code{\link{mv_into_mat}}. 142 | } 143 | -------------------------------------------------------------------------------- /man/umemfit.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/midas_functions.R 3 | \name{umemfit} 4 | \alias{umemfit} 5 | \title{Methods for obtaining (and evaluating) a variety of MEM(-MIDAS)-based models} 6 | \usage{ 7 | umemfit( 8 | model, 9 | skew, 10 | x, 11 | daily_ret = NULL, 12 | mv_m = NULL, 13 | K = NULL, 14 | z = NULL, 15 | out_of_sample = NULL, 16 | R = 100 17 | ) 18 | } 19 | \arguments{ 20 | \item{model}{Model to estimate. Valid choices are: "MEMMIDAS" for MEM-MIDAS, "MEM" for base MEM, "MEMX" for the base MEM with an X term, 21 | "MEMMIDASX" for the MEM-MIDAS-X} 22 | 23 | \item{skew}{The skewness parameter linked to lagged daily returns. Valid choices are: "YES" and "NO"} 24 | 25 | \item{x}{Dependent variable to predict. Usually the realized volatility. It must be positive and "xts" object} 26 | 27 | \item{daily_ret}{\strong{optional}. Daily returns, which must be an "xts" object. NULL by default} 28 | 29 | \item{mv_m}{\strong{optional}. MIDAS variable already transformed into a matrix, through \code{\link{mv_into_mat}} function. NULL by default} 30 | 31 | \item{K}{\strong{optional}. Number of (lagged) realizations of the MIDAS variable to consider. NULL by default 32 | for the Beta and Exponential Almon lag functions, respectively} 33 | 34 | \item{z}{\strong{optional}. Additional daily variable, which must be an "xts" object, and with the same length of x. NULL by default} 35 | 36 | \item{out_of_sample}{\strong{optional}. A positive integer indicating the number of periods before the last to keep for out of sample forecasting} 37 | 38 | \item{R}{\strong{optional}. A positive integer indicating the number of replications used to find the best starting values. 39 | Equal to 100 by default} 40 | } 41 | \value{ 42 | \code{umemfit} returns an object of class 'rumidas'. The function \code{\link{summary.rumidas}} 43 | can be used to print a summary of the results. Moreover, an object of class 'rumidas' is a list containing the following components: 44 | \itemize{ 45 | \item model: The model used for the estimation. 46 | \item rob_coef_mat: The matrix of estimated coefficients, with the QML standard errors. 47 | \item obs: The number of daily observations used for the (in-sample) estimation. 48 | \item period: The period of the in-sample estimation. 49 | \item loglik: The value of the log-likelihood at the maximum. 50 | \item inf_criteria: The AIC and BIC information criteria. 51 | \item loss_in_s: The in-sample MSE and QLIKE averages, calculated considering the distance with respect to the dependent variable. 52 | \item est_in_s: The in-sample predicted dependent variable. 53 | \item est_lr_in_s: The in-sample predicted long-run component (if present) of the dependent variable. 54 | \item loss_oos: The out-of-sample MSE and QLIKE averages, calculated considering the distance with respect to the dependent variable. 55 | \item est_oos: The out-of-sample predicted dependent variable. 56 | \item est_lr_oos: The out-of-sample predicted long-run component (if present) of the dependent variable. 57 | } 58 | } 59 | \description{ 60 | Estimates several MEM and MEM-MIDAS-based models. For details, see \insertCite{amendola2024doubly;textual}{rumidas} 61 | } 62 | \details{ 63 | Function \code{umemfit} implements the estimation and evaluation of the MEM, MEM-MIDAS MEM-X and MEM-MIDAS-X models, 64 | with and without the asymmetric term linked to negative lagged daily returns. The general framework assumes that: 65 | \deqn{x_{i,t}= \mu_{i,t}\epsilon_{i,t} = \tau_{t} \xi_{i,t} \epsilon_{i,t},} 66 | where 67 | \itemize{ 68 | \item \eqn{x_{i,t}} is a time series coming from a non-negative discrete time process for the \eqn{i}-th day (\eqn{i = 1, \ldots, N_t}) 69 | of the period \eqn{t} (for example, a week, a month or a quarter; \eqn{t = 1 , \ldots, T}); 70 | \item \eqn{\tau_{t}} is the long-run component, determining the average level of the conditional mean, varying each period \eqn{t}; 71 | \item \eqn{\xi_{i,t}} is a factor centered around one, labelled as the short--run term, which plays the role of dumping or amplifying \eqn{\tau_{i,t}}; 72 | \item \eqn{\epsilon_{i,t}} is an \eqn{iid} error term which, conditionally on the information set, has a unit mean, an unknown variance, and a probability density function 73 | defined over a non-negative support. 74 | } 75 | The short--run component of the MEM-MIDAS-X is: 76 | \deqn{\xi_{i,t}=(1-\alpha-\gamma/2-\beta) + \left(\alpha + \gamma \cdot {I}_{\left(r_{i-1,t} < 0 \right)}\right) \frac{x_{i-1,t}}{\tau_t} + \beta \xi_{i-1,t} + \delta \left(Z_{i-1,t}-E(Z)\right),} 77 | where \eqn{I_{(\cdot)}} is an indicator function, \eqn{r_{i,t}} is the daily return of the day \eqn{i} of the period \eqn{t} and \eqn{Z} is 78 | an additional X term (for instance, the VIX). When the X part is absent, then the parameter \eqn{\delta} cancels. 79 | The long-run component of the MEM-MIDAS and MEM-MIDAS-X is: 80 | \deqn{\tau_{t} = \exp \left\{ m + \theta \sum_{k=1}^K \delta_{k}(\omega) X_{t-k}\right\},} 81 | where \eqn{X_{t}} is the MIDAS term. When the "skew" parameter is set to "NO", \eqn{\gamma} disappears. 82 | The MEM and MEM-X models do not have the long- and short-run components. Therefore, they directly evolve according to \eqn{\mu_{i,t}}. 83 | When the "skew" and X parameters are present, the MEM-X is: 84 | \deqn{\mu_{i,t}= \left(1-\alpha - \gamma / 2 - \beta \right)\mu + (\alpha + \gamma I_{\left(r_{i-1,t} < 0 \right)}) x_{i-1,t} + \beta \mu_{i-1,t}+\delta \left(Z_{i-1,t}-E(Z)\right),} 85 | where \eqn{\mu=E(x_{i,t})}. When the "skew" parameter is set to "NO", in the previous equation \eqn{\gamma} cancels. 86 | Finally, when the additional X part is not present, then we have the MEM model, where \eqn{\delta} disappears. 87 | } 88 | \examples{ 89 | \donttest{ 90 | # estimate the base MEM, without the asymmetric term linked to negative lagged returns 91 | real<-(rv5['2003/2010'])^0.5 # realized volatility 92 | fit<-umemfit(model="MEM",skew="NO",x=real) 93 | fit 94 | summary.rumidas(fit) 95 | # to see the estimated coefficients with the QML standard errors: 96 | fit$rob_coef_mat 97 | 98 | # All the other elements of fit are: 99 | names(fit) 100 | 101 | # estimate the MEM-MIDAS, with the asymmetric term linked to negative lagged returns, 102 | # leaving the last 200 observations for the out-of-sample analysis 103 | r_t<-sp500['2003/2010'] 104 | real<-(rv5['2003/2010'])^0.5 # realized volatility 105 | mv_m<-mv_into_mat(real,diff(indpro),K=12,"monthly") 106 | fit_2<-umemfit(model="MEMMIDAS",skew="YES",x=real,daily_ret=r_t,mv_m=mv_m,K=12,out_of_sample=200) 107 | fit_2 108 | summary.rumidas(fit_2) 109 | # to see the estimated coefficients with the QML standard errors: 110 | fit_2$rob_coef_mat 111 | } 112 | } 113 | \references{ 114 | \insertAllCited{} 115 | } 116 | \seealso{ 117 | \code{\link{mv_into_mat}}. 118 | } 119 | -------------------------------------------------------------------------------- /man/vix.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data.R 3 | \docType{data} 4 | \name{vix} 5 | \alias{vix} 6 | \title{VIX daily data} 7 | \format{ 8 | An object of class \code{"xts"}. 9 | } 10 | \source{ 11 | \href{https://finance.yahoo.com/}{Yahoo Finance} 12 | } 13 | \usage{ 14 | data(vix) 15 | } 16 | \description{ 17 | Daily data on VIX collected from Yahoo Finance site. The VIX data 18 | have been de-annualized and multiplied by \eqn{100^{-1}}. 19 | } 20 | \examples{ 21 | head(vix) 22 | summary(vix) 23 | plot(vix) 24 | } 25 | \keyword{datasets} 26 | --------------------------------------------------------------------------------