I’m getting this insane error.
Environment details:
I’m running RStudio Server on Ubuntu:
Operating System: Ubuntu 16.04.6 LTS
Kernel: Linux 4.4.0-157-generic
Architecture: x86-64
Here is the R version stuff:
platform x86_64-pc-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 3
minor 6.1
year 2019
month 07
day 05
svn rev 76782
language R
version.string R version 3.6.1 (2019-07-05)
nickname Action of the Toes
Session info:
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.6 LTS
Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.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
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] bayestestR_0.2.2 shinystan_2.5.0 shiny_1.3.2
[4] rstan_2.19.2 ggplot2_3.2.0 StanHeaders_2.18.1-10
loaded via a namespace (and not attached):
[1] Rcpp_1.0.1 lattice_0.20-38 prettyunits_1.0.2 ps_1.3.0
[5] zoo_1.8-6 gtools_3.8.1 assertthat_0.2.1 digest_0.6.19
[9] mime_0.7 R6_2.4.0 plyr_1.8.4 ggridges_0.5.1
[13] stats4_3.6.1 colourpicker_1.0 pillar_1.4.1 rlang_0.3.4
[17] lazyeval_0.2.2 rstudioapi_0.10 miniUI_0.1.1.1 callr_3.2.0
[21] DT_0.7 shinythemes_1.1.2 shinyjs_1.0 stringr_1.4.0
[25] htmlwidgets_1.3 loo_2.1.0 igraph_1.2.4.1 munsell_0.5.0
[29] compiler_3.6.1 httpuv_1.5.1 xfun_0.7 pkgconfig_2.0.2
[33] base64enc_0.1-3 pkgbuild_1.0.3 htmltools_0.3.6 insight_0.3.0
[37] tidyselect_0.2.5 tibble_2.1.3 gridExtra_2.3 threejs_0.3.1
[41] matrixStats_0.54.0 crayon_1.3.4 dplyr_0.8.1 withr_2.1.2
[45] later_0.8.0 grid_3.6.1 xtable_1.8-4 gtable_0.3.0
[49] magrittr_1.5 scales_1.0.0 stringi_1.4.3 cli_1.1.0
[53] reshape2_1.4.3 promises_1.0.1 dygraphs_1.1.1.6 xts_0.11-2
[57] tools_3.6.1 glue_1.3.1 markdown_1.0 purrr_0.3.2
[61] crosstalk_1.0.0 rsconnect_0.8.13 processx_3.3.1 parallel_3.6.1
[65] inline_0.3.15 colorspace_1.4-1 bayesplot_1.7.0 knitr_1.23
Here is the very simple model I’m trying to fit:
N1 <- 18 # Define the sample size
y1 <- c(rep(1, 12), rep(0, 6)) # 12 successes and 6 failures
stan_data <- list(N = N1, y = y1)
stan_data
As I’m in an R Notebook, my Stan code chunk looks like this. (The chunk option specifies output.var = "bin_unif", cache = TRUE
)
data {
int<lower = 0> N;
int<lower = 0, upper = 1> y[N];
}
parameters {
real<lower = 0, upper = 1> theta;
}
model {
theta ~ uniform(0, 1); // prior
y ~ bernoulli(theta); // likelihood
}
The code giving the error is:
set.seed(54321)
fit_bin_unif <- sampling(bin_unif, data = stan_data)
Traceback:
10. Module(module, mustStart = TRUE)
9. .getModulePointer(x)
8. new("Module", .xData = <environment>)$stan_fit4modeld911db93a46_stan_d91119d4951
7. new("Module", .xData = <environment>)$stan_fit4modeld911db93a46_stan_d91119d4951
6. eval(call("$", mod, paste("stan_fit4", model_cppname, sep = "")))
5. eval(call("$", mod, paste("stan_fit4", model_cppname, sep = "")))
4. object@mk_cppmodule(object)
3. .local(object, ...)
2. sampling(bin_unif, data = stan_data)
1. sampling(bin_unif, data = stan_data)
Any help would be much appreciated. I teach Bayesian data analysis in a college classroom, so RStudio Server has to work in order for my students to learn Stan and complete the assignments.