Hi,
I get the following when I run sbc:
gamma <- stan_model("gammadiffsaddle.stan")
output <- sbc(gamma,
data = list(N = 100, mu1 = log(500), mu2 = log(200), mu3 = log(1/5), sigma1 =.5, sigma2=.5, sigma3=.5), M = 10,control=list(adapt_delta = .9) )
#1: In sbc(gamma, data = list(N = 100, mu1 = log(500), mu2 = log(200), :
# parameter names could not be calculated due to non-compliance with conventions; see help(sbc)
I canβt figure out what are the conventions that Iβm missing, maybe someone can take a look at my model?
real gammadiffs_lpdf(real y, real alpha1, real alpha2, real beta) {
//here is the long function I want to check
}
data {
int N;
real mu1;
real mu2;
real mu3;
real sigma1;
real sigma2;
real sigma3;
}
transformed data {
real alpha1_ = lognormal_rng(mu1,sigma1);
real alpha2_ = lognormal_rng(mu2,sigma2);
real beta_ = lognormal_rng(mu3,sigma3);
real y[N];
for(i in 1:N){
real y1 = gamma_rng(alpha1_, beta_);
real y2 = gamma_rng(alpha2_, beta_);
y[i] = y1 - y2;
}
}
parameters {
real<lower = 0> alpha2;
real<lower = 0> alpha1;
real<lower = 0> beta;
}
model {
target += lognormal_lpdf(alpha1 | mu1,sigma1);
target += lognormal_lpdf(alpha2 | mu2,sigma2);
target += lognormal_lpdf(beta | mu3,sigma3);
for(i in 1:N)
target += gammadiffs_lpdf(y[i]| alpha1, alpha2, beta);
}
generated quantities {
real y_[N] = y;
vector[3] pars_ = to_vector({alpha1_, alpha2_, beta_});
int ranks_[3] = {alpha1 > alpha1_, alpha2 > alpha2_, beta > beta_};
vector[N] log_lik;
for(n in 1:N)
log_lik[n] = gammadiffs_lpdf(y[n]| alpha1, alpha2, beta);
}
-
Operating System: Ubuntu
-
RStan Version: rstan_2.21.1
-
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 3.6.3 (2020-02-29)
os Ubuntu 18.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 2020-07-13
β Packages βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
package * version date lib source
assertthat 0.2.1 2019-03-21 [3] CRAN (R 3.5.3)
backports 1.1.8 2020-06-17 [3] CRAN (R 3.6.3)
BH 1.72.0-3 2020-01-08 [3] CRAN (R 3.6.2)
callr 3.4.3 2020-03-28 [1] CRAN (R 3.6.3)
checkmate 2.0.0 2020-02-06 [3] CRAN (R 3.6.2)
cli 2.0.2 2020-02-28 [3] CRAN (R 3.6.3)
colorspace 1.4-1 2019-03-18 [3] CRAN (R 3.5.3)
crayon 1.3.4 2017-09-16 [3] CRAN (R 3.5.0)
curl 4.3 2019-12-02 [1] CRAN (R 3.6.2)
desc 1.2.0 2018-05-01 [3] CRAN (R 3.5.0)
digest 0.6.25 2020-02-23 [1] CRAN (R 3.6.3)
ellipsis 0.3.1 2020-05-15 [3] CRAN (R 3.6.3)
evaluate 0.14 2019-05-28 [1] CRAN (R 3.6.2)
fansi 0.4.1 2020-01-08 [3] CRAN (R 3.6.2)
farver 2.0.3 2020-01-16 [1] CRAN (R 3.6.3)
ggplot2 * 3.3.2 2020-06-19 [1] CRAN (R 3.6.3)
glue 1.4.1 2020-05-13 [1] CRAN (R 3.6.3)
gridExtra 2.3 2017-09-09 [3] CRAN (R 3.5.0)
gtable 0.3.0 2019-03-25 [3] CRAN (R 3.5.3)
inline 0.3.15 2018-05-18 [3] CRAN (R 3.5.0)
isoband 0.2.2 2020-06-20 [3] CRAN (R 3.6.3)
jsonlite 1.7.0 2020-06-25 [1] CRAN (R 3.6.3)
labeling 0.3 2014-08-23 [3] CRAN (R 3.5.0)
lattice 0.20-41 2020-04-02 [4] CRAN (R 3.6.3)
lifecycle 0.2.0 2020-03-06 [3] CRAN (R 3.6.3)
loo 2.2.0 2019-12-19 [3] CRAN (R 3.6.2)
magrittr 1.5 2014-11-22 [3] CRAN (R 3.5.0)
MASS 7.3-51.5 2019-12-20 [1] CRAN (R 3.6.2)
Matrix 1.2-18 2019-11-27 [4] CRAN (R 3.6.1)
matrixStats 0.56.0 2020-03-13 [1] CRAN (R 3.6.3)
mgcv 1.8-31 2019-11-09 [4] CRAN (R 3.6.1)
munsell 0.5.0 2018-06-12 [3] CRAN (R 3.5.0)
nlme 3.1-147 2020-04-13 [4] CRAN (R 3.6.3)
pillar 1.4.4 2020-05-05 [3] CRAN (R 3.6.3)
pkgbuild 1.0.8 2020-05-07 [1] CRAN (R 3.6.3)
pkgconfig 2.0.3 2019-09-22 [3] CRAN (R 3.6.1)
pkgload 1.1.0 2020-05-29 [1] CRAN (R 3.6.3)
praise 1.0.0 2015-08-11 [1] CRAN (R 3.6.2)
prettyunits 1.1.1 2020-01-24 [3] CRAN (R 3.6.2)
processx 3.4.3 2020-07-05 [1] CRAN (R 3.6.3)
ps 1.3.3 2020-05-08 [1] CRAN (R 3.6.3)
R6 2.4.1 2019-11-12 [3] CRAN (R 3.6.1)
RColorBrewer 1.1-2 2014-12-07 [3] CRAN (R 3.5.0)
Rcpp 1.0.4.6 2020-04-09 [1] CRAN (R 3.6.3)
RcppEigen 0.3.3.7.0 2019-11-16 [3] CRAN (R 3.6.1)
RcppParallel 5.0.2 2020-06-24 [1] CRAN (R 3.6.3)
rlang 0.4.7 2020-07-09 [1] CRAN (R 3.6.3)
rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.6.3)
rstan * 2.21.1 2020-07-02 [1] Github (stan-dev/rstan@d69bb88)
rstudioapi 0.11 2020-02-07 [1] CRAN (R 3.6.3)
scales 1.1.1 2020-05-11 [3] CRAN (R 3.6.3)
StanHeaders * 2.21.0-5 2020-06-09 [1] CRAN (R 3.6.3)
testthat 2.3.2 2020-03-02 [1] CRAN (R 3.6.3)
tibble 3.0.1 2020-04-20 [1] CRAN (R 3.6.3)
utf8 1.1.4 2018-05-24 [3] CRAN (R 3.5.0)
V8 3.2.0 2020-06-19 [1] CRAN (R 3.6.3)
vctrs 0.3.1 2020-06-05 [1] CRAN (R 3.6.3)
viridisLite 0.3.0 2018-02-01 [3] CRAN (R 3.5.0)
withr 2.2.0 2020-04-20 [1] CRAN (R 3.6.3)
[1] /home/bruno/R/x86_64-pc-linux-gnu-library/3.6
[2] /usr/local/lib/R/site-library
[3] /usr/lib/R/site-library
[4] /usr/lib/R/library
Thanks!
Bruno