insightsengineering / insightsengineering/bonsaiforest

[Bug]: Stan error - Identifier 'cox_lhaz' is already in use.

Open
#89 2 comments 0 reactions 2 assignees Claimed by @gravesti View on GitHub
bug
Dominant language
R
Stars
3
Forks
1
PR merge metrics
No merged PRs in 30d

Description

### What happened?

Running the vignette, when I came to the horsehoe example, the call to horseshoe() failed with an apparent error in the Stan code related to variable cox_lhaz.

### Relevant log output

> horseshoe_model <- horseshoe(
+ resp = "tt_pfs", trt = "arm",
+ subgr = c("x_1", "x_2"),
+ covars = c(
+ "x_1", "x_2", "x_3", "x_4", "x_5",
+ "x_6", "x_7", "x_8", "x_9", "x_10"
+ ),
+ data = example_data,
+ resptype = "survival",
+ status = "ev_pfs",
+ chains = 2,
+ seed = 0,
+ iter = 1000,
+ warmup = 800,
+ control = list(adapt_delta = 0.95)
+ )

Compiling Stan program...
Error in stanc(file = file, model_code = model_code, model_name = model_name, :
0

Semantic error in 'string', line 16, column 9 to column 17:

Identifier 'cox_lhaz' is already in use.

> sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Rocky Linux 8.6 (Green Obsidian)

Matrix products: default
BLAS/LAPACK: FlexiBLAS OPENBLAS; LAPACK version 3.9.0

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

time zone: :/etc/localtime
tzcode source: system (glibc)

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

other attached packages:
[1] bonsaiforest_0.1.1

loaded via a namespace (and not attached):
[1] gtable_0.3.4 gbm_2.1.8.1 shape_1.4.6 tensorA_0.36.2
[5] QuickJSR_1.0.8 ggplot2_3.4.4 processx_3.8.2 inline_0.3.19
[9] lattice_0.22-5 callr_3.7.3 ps_1.7.5 vctrs_0.6.4
[13] tools_4.3.2 generics_0.1.3 curl_5.1.0 stats4_4.3.2
[17] parallel_4.3.2 sandwich_3.0-2 tibble_3.2.1 fansi_1.0.5
[21] pkgconfig_2.0.3 brms_2.22.0 Matrix_1.6-4 checkmate_2.3.1
[25] distributional_0.3.2 RcppParallel_5.1.7 lifecycle_1.0.3 compiler_4.3.2
[29] farver_2.1.1 stringr_1.5.0 splines2_0.5.3 Brobdingnag_1.2-9
[33] munsell_0.5.0 vdiffr_1.0.8 codetools_0.2-19 bayesplot_1.10.0
[37] glmnet_4.1-8 crayon_1.5.2 pillar_1.9.0 tidyr_1.3.0
[41] MASS_7.3-60 StanHeaders_2.26.28 iterators_1.0.14 bridgesampling_1.1-2
[45] abind_1.4-5 multcomp_1.4-25 foreach_1.5.2 nlme_3.1-164
[49] posterior_1.6.0 rstan_2.32.3 tidyselect_1.2.0 mvtnorm_1.2-4
[53] stringi_1.7.12 dplyr_1.1.4 purrr_1.0.2 labeling_0.4.3
[57] forcats_1.0.0 splines_4.3.2 grid_4.3.2 colorspace_2.1-0
[61] cli_3.6.1 magrittr_2.0.3 loo_2.8.0 pkgbuild_1.4.2
[65] survival_3.5-7 utf8_1.2.4 broom_1.0.5 TH.data_1.1-2
[69] withr_2.5.2 prettyunits_1.2.0 scales_1.3.0 backports_1.4.1
[73] estimability_1.4.1 emmeans_1.8.9 matrixStats_1.1.0 gridExtra_2.3
[77] zoo_1.8-12 coda_0.19-4 V8_4.4.1 rstantools_2.3.1.1
[81] rlang_1.1.2 Rcpp_1.0.11 xtable_1.8-4 glue_1.6.2
[85] jsonlite_1.8.7 rstudioapi_0.15.0 R6_2.5.1

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct.

### Contribution Guidelines

- [x] I agree to follow this project's Contribution Guidelines.

### Security Policy

- [x] I agree to follow this project's Security Policy.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.