Skip to content

Commit

Permalink
OPG error management
Browse files Browse the repository at this point in the history
  • Loading branch information
onnokleen committed May 12, 2020
1 parent 9dfde37 commit 0e8f05f
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 21 deletions.
2 changes: 2 additions & 0 deletions CRAN-RELEASE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This package was submitted to CRAN on 2019-12-04.
Once it is accepted, delete this file and tag the release (commit 9dfde37cd9).
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Package: mfGARCH
Title: Mixed-Frequency GARCH Models
Version: 0.1.9
Version: 0.2.0
Authors@R: person("Onno", "Kleen", email = "r@onnokleen.de", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-4731-4640"))
Description: Estimating GARCH-MIDAS (MIxed-DAta-Sampling) models (Engle, Ghysels, Sohn, 2013, <doi:10.1162/REST_a_00300>) and related statistical inference, accompanying the paper "Two are better than one: volatility forecasting using multiplicative component GARCH models" by Conrad and Kleen (2018, <doi:10.2139/ssrn.2752354>). The GARCH-MIDAS model decomposes the conditional variance of (daily) stock returns into a short- and long-term component, where the latter may depend on an exogenous covariate sampled at a lower frequency.
Depends:
R (>= 3.3.0)
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.1.1
RoxygenNote: 7.1.0
Imports:
Rcpp,
graphics,
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v0.2.0
- Better error management for OPG standard errors

v0.1.9
- Compatibility with R 4.0.0

Expand Down
6 changes: 3 additions & 3 deletions R/fit_mfgarch.R
Original file line number Diff line number Diff line change
Expand Up @@ -882,12 +882,12 @@ fit_mfgarch <- function(data, y, x = NULL, K = NULL, low.freq = "date", var.rati

opg.std.err <- try({sqrt(diag(solve(crossprod(jacobian(func = function(theta) -lf(theta), x = par)))))},
silent = TRUE)
if (class(inv_hessian)[1] == "try-error") {
if (class(opg.std.err)[1] == "try-error") {
warning("Inverting the OPG matrix failed. No OPG standard errors calculated.")
opg.std.err <- NA
} else {
opg.std.err <- opg.std.err * sqrt((mean(df.fitted$residuals^4, na.rm = TRUE) - 1) / 2)
}
# browser()
opg.std.err <- opg.std.err * sqrt((mean(df.fitted$residuals^4, na.rm = TRUE) - 1) / 2)

if (class(inv_hessian)[1] == "try-error") {
warning("Inverting the Hessian matrix failed. No robust standard errors calculated. Possible workaround: Multiply returns by 100.")
Expand Down
6 changes: 4 additions & 2 deletions man/df_financial.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions man/df_mfgarch.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 16 additions & 5 deletions man/fit_mfgarch.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 18 additions & 3 deletions man/simulate_mfgarch.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 15 additions & 2 deletions man/simulate_mfgarch_diffusion.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 15 additions & 2 deletions man/simulate_mfgarch_rv_dependent.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0e8f05f

Please sign in to comment.