Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TVAR.sim/boot: allow for external threshold variable thVar #46

Open
1 task
MatthieuStigler opened this issue Oct 16, 2022 · 0 comments
Open
1 task

TVAR.sim/boot: allow for external threshold variable thVar #46

MatthieuStigler opened this issue Oct 16, 2022 · 0 comments
Labels
feature-request Asking for a new feature

Comments

@MatthieuStigler
Copy link
Owner

Multiple users requested to have an external threshold in TVAR.sim. This is currently not possible, triggering message Cannot (yet) bootstrap model with external thVar or commonInter.

I won't have time to do this anytime soon, but here would some steps to follow:

  • tsDyn:::TVAR.gen has thVar but uses z2 ( as in if (round(z2[i - thDelay], round_digits) <= Thresh[1])), so need to replace
library(tsDyn)
#> Registered S3 method overwritten by 'quantmod':
#>   method            from
#>   as.zoo.data.frame zoo

## works with internal thVar
tv <- TVAR(zeroyld, lag=2, nthresh=1, thDelay=1, trim=0.1, mTh=1, plot=FALSE)
#> Best unique threshold 10.653
head(TVAR.boot(tv),2)
#>      short.run long.run
#> [1,]     2.183    1.575
#> [2,]     2.246    1.545

## works with internal
tv_ext <- TVAR(zeroyld, lag=2, nthresh=1, thVar=rnorm(nrow(zeroyld)), plot=FALSE)
#> Best unique threshold -1.341946
TVAR.boot(tv_ext)
#> Error in TVAR.boot(tv_ext): Cannot (yet) bootstrap model with external thVar or commonInter

Created on 2022-10-16 by the reprex package (v2.0.1)

@MatthieuStigler MatthieuStigler added the feature-request Asking for a new feature label Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Asking for a new feature
Projects
None yet
Development

No branches or pull requests

1 participant