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.LRtest function is only working for "1vs" but not for "2vs3" #51

Open
yasmine131119 opened this issue Apr 27, 2023 · 1 comment
Open
Assignees
Labels

Comments

@yasmine131119
Copy link

I want to estimate a TVAR model that includes an external threshold variable but the TVAR.LRtest function is only working for "1vs" but not for "2vs3".
#codes examples
Y<- TVAR.LRtest(X ,
lag=2,
trend=TRUE,
thVar=diff(Z),
thDelay=1,
nboot=100, plot=FALSE, trim=0.15,test="2vs3")
Error in if (round(z2[i - bestDelay], ndig) <= bestThresh) { :
missing value where TRUE/FALSE needed

@MatthieuStigler
Copy link
Owner

MatthieuStigler commented May 1, 2023

Hi Yasmine

Thanks for sharing the issue (though your example was neither minimum nor self-reproducible example, in the future see https://stackoverflow.com/help/minimal-reproducible-example), but here is a reprex confirming that you found a bug. I am quite busy so not sure when I will be able to fix it.

library(tsDyn)
#> Registered S3 method overwritten by 'quantmod':
#>   method            from
#>   as.zoo.data.frame zoo

data(barry)
Y <- TVAR.LRtest(barry[,1:2], 
                thVar=barry[,3],
                plot=FALSE, test="1vs")
#> Warning: the thDelay values do not correspond to the univariate implementation in tsdyn

Y <- TVAR.LRtest(barry[,1:2], 
                thVar=barry[,3],
                plot=FALSE, test="2vs3")
#> Warning: the thDelay values do not correspond to the univariate implementation in tsdyn
#> Error in if (round(z2[i - bestDelay], ndig) <= bestThresh) {: missing value where TRUE/FALSE needed

Created on 2023-05-01 with reprex v2.0.2

@MatthieuStigler MatthieuStigler self-assigned this May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants