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

Rbeast segfaults when type of y is boolean #38

Open
Noskario opened this issue Sep 27, 2024 · 2 comments
Open

Rbeast segfaults when type of y is boolean #38

Noskario opened this issue Sep 27, 2024 · 2 comments

Comments

@Noskario
Copy link

When I write

Rbeast::beast(rep(TRUE, 40))

my RStudio terminates with "R Session Aborted - R encountered a fatal error. - The session was terminated. - Start New Session"

I get no other error message.

When started as a background job in RStudio I get "ERROR: The input data has an uknown numeric type!".

What I would prefer: A clear error message without terminating R.

My sessionInfo:

> sessionInfo()
R version 4.3.1 (2023-06-16 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default


locale:
[1] LC_COLLATE=German_Germany.utf8  LC_CTYPE=German_Germany.utf8    LC_MONETARY=German_Germany.utf8
[4] LC_NUMERIC=C                    LC_TIME=German_Germany.utf8    

time zone: Europe/Berlin
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] Rbeast_1.0.1

loaded via a namespace (and not attached):
 [1] digest_0.6.33     later_1.3.1       R6_2.5.1          httpuv_1.6.11     fastmap_1.1.1    
 [6] magrittr_2.0.3    shiny_1.7.5       htmltools_0.5.5   lifecycle_1.0.4   DT_0.29          
[11] promises_1.2.0.1  cli_3.6.1         xtable_1.8-4      grid_4.3.1        compiler_4.3.1   
[16] rstudioapi_0.15.0 tools_4.3.1       mime_0.12         ellipsis_0.3.2    Rcpp_1.0.11      
[21] htmlwidgets_1.6.2 rlang_1.1.1       shinyjs_2.1.0   
@zhaokg
Copy link
Owner

zhaokg commented Sep 27, 2024

Dear Noskario,

Thanks a lot for this important feedback. That is very useful. I will definitely follow your advice to do a better sanity check about the data type.

To be more specific, there are a few more reasons why the crash occurred:
(1) the data rep(TRUE, 40) is a flat line, which is somehow an extreme case with an error variance of zero if interpreted as a statistical model.
(2) By default, the season component is on, the beast function was trying to fit a model Y=trend+seasonality+error. Beast itiself can not determine whether or not there is a seasonal/periodic component or nt. It has to be specified by the user.

With that said, the right way I expected users to run on your case is

beast(  as.numeric( rep(TRUE, 40)), season="none")

I will try to debug a little to fix the crash, but the new version won't be released immediately because CRAN's policies do not allow package developers to update the package too frequently.

Thanks again for this important info.
Kaiguang

@Noskario
Copy link
Author

Thanks for your advice! I want to add another problem that can occur: "hasOutlier = TRUE" also makes beast segfault:

library(Rbeast)
bmod <- beast(
  rep(1.3, 40),
  season = "none",
  hasOutlier = TRUE
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants