stan-dev / cmdstanr

CmdStanR: the R interface to CmdStan
https://mc-stan.org/cmdstanr/
Other
143 stars 62 forks source link

cmdstanr mangled output #752

Closed maxbiostat closed 1 year ago

maxbiostat commented 1 year ago

Describe the bug I get output of the form

 variable                                                 mean
 lp__     -\033[31m\033[4m1\033[24m49\033[39m\033[31m3\033[39m
 beta[1]                                                    16
 beta[2]                                                     5
 beta[3]                                                     1
 beta[4]                                                     0
 sigma_sq                                                  326
                                               median sd mad
 -\033[31m\033[4m1\033[24m49\033[39m\033[31m3\033[39m  2   2
                                                   16  8   8
                                                    5  2   2
                                                    1  0   0
                                                    0  0   0
                                                  325 22  22
                                                   q5
 -\033[31m\033[4m1\033[24m49\033[39m\033[31m7\033[39m
                                                    2
                                                    1
                                                    0
                                                    0
                                                  292
                                                  q95 rhat ess_bulk ess_tail
 -\033[31m\033[4m1\033[24m49\033[39m\033[31m1\033[39m    1      459      613
                                                   29    1      541      484
                                                    9    1      777      622
                                                    1    1      680      675
                                                    1    1      563      566
                                                  364    1      583      486

To Reproduce Run

conjugate <- cmdstan_model("linear_regression_conjugate.stan")
conjugate$sample(data = linreg.data,
                            chains = 1)

where this linear_regression_conjugate.stan.txt

Expected behavior Normal output without the extraneous characters.

Operating system Windows 10 Enterprise

CmdStanR version number 0.5.3

Additional context

> sessionInfo()
R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale:
[1] LC_COLLATE=Portuguese_Brazil.utf8  LC_CTYPE=Portuguese_Brazil.utf8   
[3] LC_MONETARY=Portuguese_Brazil.utf8 LC_NUMERIC=C                      
[5] LC_TIME=Portuguese_Brazil.utf8    

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

other attached packages:
 [1] lubridate_1.9.2 forcats_1.0.0   stringr_1.5.0   dplyr_1.1.0     purrr_1.0.1    
 [6] readr_2.1.4     tidyr_1.3.0     tibble_3.1.8    ggplot2_3.4.1   tidyverse_2.0.0
[11] cmdstanr_0.5.3 

loaded via a namespace (and not attached):
 [1] nlme_3.1-160         matrixStats_0.63.0   xts_0.13.0           bit64_4.0.5         
 [5] threejs_0.3.3        rstan_2.21.8         tensorA_0.36.2       tools_4.2.2         
 [9] backports_1.4.1      utf8_1.2.3           R6_2.5.1             DT_0.27             
[13] colorspace_2.1-0     withr_2.5.0          tidyselect_1.2.0     gridExtra_2.3       
[17] prettyunits_1.1.1    processx_3.8.0       bit_4.0.5            compiler_4.2.2      
[21] cli_3.6.0            shinyjs_2.1.0        colourpicker_1.2.0   posterior_1.4.0     
[25] scales_1.2.1         dygraphs_1.1.1.6     checkmate_2.1.0      callr_3.7.3         
[29] digest_0.6.31        StanHeaders_2.21.0-7 minqa_1.2.5          rstanarm_2.21.3     
[33] base64enc_0.1-3      pkgconfig_2.0.3      htmltools_0.5.4      lme4_1.1-32         
[37] fastmap_1.1.1        htmlwidgets_1.6.1    rlang_1.0.6          rstudioapi_0.14     
[41] shiny_1.7.4          farver_2.1.1         generics_0.1.3       zoo_1.8-11          
[45] jsonlite_1.8.4       crosstalk_1.2.0      gtools_3.9.4         vroom_1.6.1         
[49] distributional_0.3.1 inline_0.3.19        magrittr_2.0.3       loo_2.6.0           
[53] bayesplot_1.10.0     Matrix_1.5-1         Rcpp_1.0.10          munsell_0.5.0       
[57] fansi_1.0.4          abind_1.4-5          lifecycle_1.0.3      stringi_1.7.12      
[61] MASS_7.3-58.1        plyr_1.8.8           pkgbuild_1.4.0       grid_4.2.2          
[65] parallel_4.2.2       promises_1.2.0.1     crayon_1.5.2         miniUI_0.1.1.1      
[69] lattice_0.20-45      splines_4.2.2        hms_1.1.2            knitr_1.42          
[73] ps_1.7.2             pillar_1.8.1         igraph_1.4.1         boot_1.3-28         
[77] markdown_1.5         shinystan_2.6.0      reshape2_1.4.4       codetools_0.2-18    
[81] stats4_4.2.2         rstantools_2.3.1     glue_1.6.2           data.table_1.14.8   
[85] RcppParallel_5.1.7   nloptr_2.0.3         vctrs_0.5.2          tzdb_0.3.0          
[89] httpuv_1.6.9         gtable_0.3.1         xfun_0.37            mime_0.12           
[93] xtable_1.8-4         later_1.3.0          survival_3.4-0       shinythemes_1.2.0   
[97] timechange_0.2.0     ellipsis_0.3.2 
andrjohns commented 1 year ago

Can you try updating your posterior package? I believe this has been resolved in version 1.4.1

rok-cesnovar commented 1 year ago

Is the updated posterior package on CRAN? Should we make that the minimum version @andrjohns ?

andrjohns commented 1 year ago

Yep the update's on CRAN, so updating the minimum makes sense

jgabry commented 1 year ago

Yeah good call

jgabry commented 1 year ago

Just opened a PR

jgabry commented 1 year ago

I guess before we merge #753 @maxbiostat can you confirm that updating posterior fixes this on your end? Thanks!

maxbiostat commented 1 year ago

I updated via

remotes::install_github("stan-dev/posterior")

and can confirm the problem went away.

jgabry commented 1 year ago

Great, thanks!

On Mon, Apr 3, 2023 at 1:19 PM Luiz Max F. Carvalho < @.***> wrote:

I updated via

remotes::install_github("stan-dev/posterior")

and can confirm the problem went away.

— Reply to this email directly, view it on GitHub https://github.com/stan-dev/cmdstanr/issues/752#issuecomment-1494849325, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3PQQ734I7AMM3VEW5GJBLW7MPEVANCNFSM6AAAAAAWRQRZBY . You are receiving this because you commented.Message ID: @.***>