Hi, yet again I’m trying my luck with the latest rstan and bridge sampling and no success.
I have Linux, I’ve installed rstan like this, which seems to work so far.
remove.packages(c("StanHeaders", "rstan"))
install.packages("StanHeaders", repos = c("https://mc-stan.org/r-packages/", getOption("repos")), type = "source")
install.packages("rstan", repos = c("https://mc-stan.org/r-packages/", getOption("repos")), type = "source")
When I try to use bridgesampling I get. (I just tried to compare dumb model with itself very few data points with brms)
> bayes_factor(m,m)
*** caught segfault ***
address (nil), cause 'memory not mapped'
Traceback:
1: .External(list(name = "CppMethod__invoke_notvoid", address = <pointer: 0x55de94c5fe10>, dll = list(name = "Rcpp", path = "/home/bruno/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/libs/Rcpp.so", dynamicLookup = TRUE, handle = <pointer: 0x55de969abab0>, info = <pointer: 0x55de949427b0>), numParameters = -1L), <pointer: 0x55dea30262e0>, <pointer: 0x55de9e57ae10>, .pointer, ...)
2: object@.MISC$stan_fit_instance$unconstrain_pars(pars)
3: .local(object, ...)
4: rstan::unconstrain_pars(stanfit_model, .rstan_relist(theta, skeleton))
5: rstan::unconstrain_pars(stanfit_model, .rstan_relist(theta, skeleton))
6: FUN(newX[, i], ...)
7: apply(ex, 1:2, FUN = function(theta) { rstan::unconstrain_pars(stanfit_model, .rstan_relist(theta, skeleton))})
8: bridge_sampler.stanfit(samples$fit, ...)
9: bridge_sampler(samples$fit, ...)
10: doTryCatch(return(expr), name, parentenv, handler)
11: tryCatchOne(expr, names, parentenv, handlers[[1L]])
12: tryCatchList(expr, classes, parentenv, handlers)
13: tryCatch(expr, error = function(e) { call <- conditionCall(e) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L) dcall <- deparse(call, nlines = 1L) prefix <- paste("Error in", dcall, ": ") LONG <- 75L sm <- strsplit(conditionMessage(e), "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG) prefix <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) if (!silent && isTRUE(getOption("show.error.messages"))) { cat(msg, file = outFile) .Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error", condition = e))})
14: try(bridge_sampler(samples$fit, ...))
15: bridge_sampler.brmsfit(x1, ...)
16: bridge_sampler(x1, ...)
17: bayes_factor.brmsfit(m, m)
18: bayes_factor(m, m)
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Bridge sampling was working fine with the last rstan from CRAN, and I think that at some point was working with one dev version, but then it stop working with newer dev versions, and I had to roll back to the CRAN version. Now I really want to use the latest rstan… Is there any way to fix this? Is there any special way to install rstan so that bridge sampling works?
@Henrik_Singmann , any experience with this?
-
Operating System: Ubuntu 20.04.4 LTS
-
RStan Version:
rstan_2.26.9 StanHeaders_2.26.9 brms_2.16.3 Rcpp_1.0.8.3
-
Output of
writeLines(readLines(file.path(Sys.getenv("HOME"), ".R/Makevars")))
:
CXX14FLAGS=-O3 -march=native -mtune=native -fPIC
CXX14=g++
- Output of
devtools::session_info("rstan")
:
─ Session info ───────────────────────────────────────────────────────────────
setting value
version R version 4.1.2 (2021-11-01)
os Ubuntu 20.04.4 LTS
system x86_64, linux-gnu
ui X11
language (EN)
collate en_US.UTF-8
ctype en_US.UTF-8
tz Europe/Amsterdam
date 2022-04-08
pandoc 2.2.3.2 @ /home/bruno/anaconda3/bin/pandoc
─ Packages ───────────────────────────────────────────────────────────────────
package * version date (UTC) lib source
backports 1.4.1 2021-12-13 [1] CRAN (R 4.1.1)
BH 1.78.0-0 2021-12-15 [3] CRAN (R 4.1.2)
callr 3.7.0 2021-04-20 [3] CRAN (R 4.0.5)
checkmate 2.0.0 2020-02-06 [1] CRAN (R 4.1.1)
cli 3.2.0 2022-02-14 [1] CRAN (R 4.1.1)
colorspace 2.0-3 2022-02-21 [1] CRAN (R 4.1.1)
crayon 1.5.0 2022-02-14 [1] CRAN (R 4.1.1)
curl 4.3.2 2021-06-23 [3] CRAN (R 4.1.0)
desc 1.4.0 2021-09-28 [3] CRAN (R 4.1.1)
digest 0.6.29 2021-12-01 [1] CRAN (R 4.1.1)
ellipsis 0.3.2 2021-04-29 [3] CRAN (R 4.0.5)
fansi 1.0.2 2022-01-14 [1] CRAN (R 4.1.1)
farver 2.1.0 2021-02-28 [3] CRAN (R 4.0.4)
ggplot2 3.3.5 2021-06-25 [1] CRAN (R 4.1.1)
glue 1.6.2 2022-02-24 [1] CRAN (R 4.1.1)
gridExtra 2.3 2017-09-09 [1] CRAN (R 4.1.1)
gtable 0.3.0 2019-03-25 [3] CRAN (R 4.0.0)
inline 0.3.19 2021-05-31 [1] CRAN (R 4.1.1)
isoband 0.2.5 2021-07-13 [3] CRAN (R 4.1.0)
jsonlite 1.8.0 2022-02-22 [3] CRAN (R 4.1.2)
labeling 0.4.2 2020-10-20 [3] CRAN (R 4.0.3)
lattice 0.20-45 2021-09-22 [4] CRAN (R 4.1.1)
lifecycle 1.0.1 2021-09-24 [1] CRAN (R 4.1.1)
loo 2.4.1 2020-12-09 [1] CRAN (R 4.1.1)
magrittr 2.0.2 2022-01-26 [1] CRAN (R 4.1.1)
MASS 7.3-55 2022-01-13 [4] CRAN (R 4.1.2)
Matrix 1.4-0 2021-12-08 [4] CRAN (R 4.1.2)
matrixStats 0.61.0 2021-09-17 [1] CRAN (R 4.1.1)
mgcv 1.8-39 2022-02-24 [4] CRAN (R 4.1.2)
munsell 0.5.0 2018-06-12 [3] CRAN (R 4.0.0)
nlme 3.1-155 2022-01-13 [4] CRAN (R 4.1.2)
pillar 1.7.0 2022-02-01 [1] CRAN (R 4.1.1)
pkgbuild 1.3.1 2021-12-20 [3] CRAN (R 4.1.2)
pkgconfig 2.0.3 2019-09-22 [3] CRAN (R 4.0.0)
prettyunits 1.1.1 2020-01-24 [3] CRAN (R 4.0.0)
processx 3.5.2 2021-04-30 [3] CRAN (R 4.0.5)
ps 1.6.0 2021-02-28 [3] CRAN (R 4.0.4)
R6 2.5.1 2021-08-19 [3] CRAN (R 4.1.1)
RColorBrewer 1.1-2 2014-12-07 [3] CRAN (R 4.0.0)
Rcpp 1.0.8.3 2022-03-17 [1] CRAN (R 4.1.2)
RcppEigen 0.3.3.9.1 2020-12-17 [1] CRAN (R 4.1.1)
RcppParallel 5.1.4 2021-05-04 [1] CRAN (R 4.1.1)
rlang 1.0.2 2022-03-04 [1] CRAN (R 4.1.2)
rprojroot 2.0.2 2020-11-15 [3] CRAN (R 4.0.3)
rstan 2.26.9 2022-04-07 [1] local
scales 1.1.1 2020-05-11 [3] CRAN (R 4.0.0)
StanHeaders 2.26.9 2022-04-07 [1] local
tibble 3.1.6 2021-11-07 [1] CRAN (R 4.1.1)
utf8 1.2.2 2021-07-24 [3] CRAN (R 4.1.0)
V8 4.1.0 2022-02-06 [1] CRAN (R 4.1.2)
vctrs 0.3.8 2021-04-29 [3] CRAN (R 4.0.5)
viridisLite 0.4.0 2021-04-13 [3] CRAN (R 4.0.5)
withr 2.5.0 2022-03-03 [1] CRAN (R 4.1.2)
[1] /home/bruno/R/x86_64-pc-linux-gnu-library/4.1
[2] /usr/local/lib/R/site-library
[3] /usr/lib/R/site-library
[4] /usr/lib/R/library