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

Problem with LaTeX table: ErrorL subscription out of bounds #190

Open
storopoli opened this issue Feb 27, 2021 · 6 comments
Open

Problem with LaTeX table: ErrorL subscription out of bounds #190

storopoli opened this issue Feb 27, 2021 · 6 comments

Comments

@storopoli
Copy link
Sponsor

There is an error when generating LaTeX table in shinystan. I've run the model with brms, but this happens when also converting brms code and data to rstan:

library(brms)
library(rstan)
library(shinystan) 

fit <- brm(
    bf(mpg ~ 1 + (1 | cyl) + hp + wt, decomp = "QR"),
    data = mtcars,
    family = gaussian
)

code <- stancode(fit)  
dat <- standata(fit)
fit2 <- stan(model_code = code, data = dat) 
launch_shinystan(fit2) # or `brmsfit` fit

The error only happens when I select Quantile: 97.5%, see pics below:
Screen Shot 2021-02-27 at 06 19 54
Screen Shot 2021-02-27 at 06 20 04

@bbbales2
Copy link
Member

bbbales2 commented Mar 1, 2021

@VeenDuco do you know where in the code this might be?

@VeenDuco
Copy link
Collaborator

VeenDuco commented Mar 1, 2021

Hey, this should be here and here. My guess would be that we do not name the slots of the summary output correctly. Although the code does seem to refer to 97.5%, which you also get in the summary table.

@VeenDuco
Copy link
Collaborator

VeenDuco commented Mar 1, 2021

In version 3.0 I don't get this error, see below. Will check now for the CRAN version.

Screen Shot 2021-03-01 at 14 18 00

@VeenDuco
Copy link
Collaborator

VeenDuco commented Mar 1, 2021

I also don't get an error with shinystan 2.5. @storopoli could you post your session information?

Screen Shot 2021-03-01 at 14 22 55

@storopoli
Copy link
Sponsor Author

r$> sessionInfo()                                                                                                                                                   
R version 4.0.4 (2021-02-15)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 11.2.2

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] shinystan_2.5.0      shiny_1.6.0          rstan_2.21.2         ggplot2_3.3.3        StanHeaders_2.21.0-7 brms_2.14.4          Rcpp_1.0.6          

loaded via a namespace (and not attached):
  [1] nlme_3.1-152         matrixStats_0.58.0   xts_0.12.1           threejs_0.3.3        backports_1.2.1      tools_4.0.4          utf8_1.1.4          
  [8] R6_2.5.0             DT_0.17              DBI_1.1.1            mgcv_1.8-34          projpred_2.0.2       colorspace_2.0-0     withr_2.4.1         
 [15] tidyselect_1.1.0     gridExtra_2.3        prettyunits_1.1.1    processx_3.4.5       Brobdingnag_1.2-6    emmeans_1.5.4        curl_4.3            
 [22] compiler_4.0.4       cli_2.3.1            shinyjs_2.0.0        sandwich_3.0-0       colourpicker_1.1.0   scales_1.1.1         dygraphs_1.1.1.6    
 [29] mvtnorm_1.1-1        ggridges_0.5.3       callr_3.5.1          stringr_1.4.0        digest_0.6.27        minqa_1.2.4          base64enc_0.1-3     
 [36] pkgconfig_2.0.3      htmltools_0.5.1.1    lme4_1.1-26          fastmap_1.1.0        htmlwidgets_1.5.3    rlang_0.4.10         generics_0.1.0      
 [43] jsonlite_1.7.2       zoo_1.8-8            crosstalk_1.1.1      gtools_3.8.2         dplyr_1.0.4          inline_0.3.17        magrittr_2.0.1      
 [50] loo_2.4.1            bayesplot_1.8.0      Matrix_1.3-2         munsell_0.5.0        fansi_0.4.2          abind_1.4-5          lifecycle_1.0.0     
 [57] multcomp_1.4-16      stringi_1.5.3        MASS_7.3-53.1        pkgbuild_1.2.0       plyr_1.8.6           grid_4.0.4           parallel_4.0.4      
 [64] promises_1.2.0.1     crayon_1.4.1         miniUI_0.1.1.1       lattice_0.20-41      splines_4.0.4        knitr_1.31           ps_1.5.0            
 [71] pillar_1.5.0         igraph_1.2.6         boot_1.3-27          estimability_1.3     markdown_1.1         codetools_0.2-18     reshape2_1.4.4      
 [78] stats4_4.0.4         rstantools_2.1.1     glue_1.4.2           V8_3.4.0             RcppParallel_5.0.3   vctrs_0.3.6          nloptr_1.2.2.2      
 [85] httpuv_1.5.5         gtable_0.3.0         purrr_0.3.4          assertthat_0.2.1     xfun_0.21            mime_0.10            xtable_1.8-4        
 [92] coda_0.19-4          later_1.1.0.1        survival_3.2-7       rsconnect_0.8.16     tibble_3.1.0         shinythemes_1.2.0    gamm4_0.2-6         
 [99] statmod_1.4.35       TH.data_1.0-10       ellipsis_0.3.1       bridgesampling_1.0-0

@storopoli
Copy link
Sponsor Author

And here is the full stack trace from the console:

Listening on http://127.0.0.1:3504
Warning: Error in [: subscript out of bounds
  134: as.data.frame
  133: .tex_summary [helper_functions/summary_stats_helpers.R#29]
  131: <reactive:summary_stats_latex> [server_files/pages/estimate/server/summary_stats_latex.R#12]
  115: summary_stats_latex
  102: renderPrint [server_files/pages/estimate/server/summary_stats_latex.R#37]
  101: func
   85: renderFunc
   84: output$summary_stats_latex_out
    4: shiny::runApp
    3: launch
    2: launch_shinystan.default
Warning: Error in [: subscript out of bounds
  117: <Anonymous>
Warning: Error in [: subscript out of bounds
  133: .param_summary [helper_functions/summary_stats_helpers.R#5]
  131: <reactive:summary_stats_latex> [server_files/pages/estimate/server/summary_stats_latex.R#7]
  115: summary_stats_latex
  102: renderPrint [server_files/pages/estimate/server/summary_stats_latex.R#37]
  101: func
   85: renderFunc
   84: output$summary_stats_latex_out
    4: shiny::runApp
    3: launch
    2: launch_shinystan.default

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

3 participants