The following command calls Stan with specific options.
For a detailed description type "?stan".
samples <- stan(file="Rate_5_model.stan",
data=data,
init=myinits, # If not specified, gives random inits
pars=parameters,
iter=10000,
chains=1,
thin=1,
warmup = 100, # Stands for burn-in; Default = iter/2
seed = 123 # Setting seed; Default is random seed
)
TRANSLATING MODEL 'Rate_5_model' FROM Stan CODE TO C++ CODE NOW.
COMPILING THE C++ CODE FOR MODEL 'Rate_5_model' NOW.
In file included from file1cdfd6e9e25.cpp:407:
In file included from /Library/Frameworks/R.framework/Versions/3.1/Resources/library/rstan/include/rstan/rstaninc.hpp:3:
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/rstan/include/rstan/stan_fit.hpp:732:15: warning: unused variable 'return_code' [-Wunused-variable]
int return_code = stan::common::do_bfgs_optimize(model, lbfgs, base_rng,
^
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/rstan/include/rstan/stan_fit.hpp:796:15: warning: unused variable 'return_code' [-Wunused-variable]
int return_code = stan::common::do_bfgs_optimize(model, bfgs, base_rng,
^
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/rstan/include/rstan/stan_fit.hpp:616:14: warning: unused variable 'init_log_prob' [-Wunused-variable]
double init_log_prob;
^
In file included from file1cdfd6e9e25.cpp:8:
In file included from /Library/Frameworks/R.framework/Versions/3.1/Resources/library/rstan/include//stansrc/stan/model/model_header.hpp:16:
In file included from /Library/Frameworks/R.framework/Versions/3.1/Resources/library/rstan/include//stansrc/stan/agrad/rev.hpp:5:
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/rstan/include//stansrc/stan/agrad/rev/chainable.hpp:87:17: warning: 'static' function 'set_zero_all_adjoints' declared in header file should be declared 'static inline' [-Wunneeded-internal-declaration]
static void set_zero_all_adjoints() {
^
In file included from file1cdfd6e9e25.cpp:8:
In file included from /Library/Frameworks/R.framework/Versions/3.1/Resources/library/rstan/include//stansrc/stan/model/model_header.hpp:23:
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/rstan/include//stansrc/stan/io/dump.hpp:26:14: warning: function 'product' is not needed and will not be emitted [-Wunneeded-internal-declaration]
size_t product(std::vector dims) {
^
5 warnings generated.
print(samples)
Inference for Stan model: Rate_5_model.
1 chains, each with iter=10000; warmup=5000; thin=1;
post-warmup draws per chain=5000, total post-warmup draws=5000.
Samples were drawn using NUTS(diag_e) at Sat Dec 20 18:23:40 2014.
For each parameter, n_eff is a crude measure of effective sample size,
and Rhat is the potential scale reduction factor on split chains (at
convergence, Rhat=1).
ylab="Success Count 2", xlim=c(-1, n1+1), ylim=c(-1,n2+1))
Error in plot(k1, k2, type = "p", pch = 4, cex = 2, lwd = 2, xlab = "Success Count 1", :
error in evaluating the argument 'x' in selecting a method for function 'plot': Error: object 'k1' not found
nsamples <- length(theta)
sc <- 10
for (i in 0:n1)
Warnings and errors. See below
rstan (Version 2.5.0, packaged: 2014-10-22 14:19:22 UTC, GitRev: e52c66f42e81)
TRANSLATING MODEL 'Rate_5_model' FROM Stan CODE TO C++ CODE NOW. COMPILING THE C++ CODE FOR MODEL 'Rate_5_model' NOW. In file included from file1cdfd6e9e25.cpp:407: In file included from /Library/Frameworks/R.framework/Versions/3.1/Resources/library/rstan/include/rstan/rstaninc.hpp:3: /Library/Frameworks/R.framework/Versions/3.1/Resources/library/rstan/include/rstan/stan_fit.hpp:732:15: warning: unused variable 'return_code' [-Wunused-variable] int return_code = stan::common::do_bfgs_optimize(model, lbfgs, base_rng, ^ /Library/Frameworks/R.framework/Versions/3.1/Resources/library/rstan/include/rstan/stan_fit.hpp:796:15: warning: unused variable 'return_code' [-Wunused-variable] int return_code = stan::common::do_bfgs_optimize(model, bfgs, base_rng, ^ /Library/Frameworks/R.framework/Versions/3.1/Resources/library/rstan/include/rstan/stan_fit.hpp:616:14: warning: unused variable 'init_log_prob' [-Wunused-variable] double init_log_prob; ^ In file included from file1cdfd6e9e25.cpp:8: In file included from /Library/Frameworks/R.framework/Versions/3.1/Resources/library/rstan/include//stansrc/stan/model/model_header.hpp:16: In file included from /Library/Frameworks/R.framework/Versions/3.1/Resources/library/rstan/include//stansrc/stan/agrad/rev.hpp:5: /Library/Frameworks/R.framework/Versions/3.1/Resources/library/rstan/include//stansrc/stan/agrad/rev/chainable.hpp:87:17: warning: 'static' function 'set_zero_all_adjoints' declared in header file should be declared 'static inline' [-Wunneeded-internal-declaration] static void set_zero_all_adjoints() { ^ In file included from file1cdfd6e9e25.cpp:8: In file included from /Library/Frameworks/R.framework/Versions/3.1/Resources/library/rstan/include//stansrc/stan/model/model_header.hpp:23: /Library/Frameworks/R.framework/Versions/3.1/Resources/library/rstan/include//stansrc/stan/io/dump.hpp:26:14: warning: function 'product' is not needed and will not be emitted [-Wunneeded-internal-declaration] size_t product(std::vector dims) {
^
5 warnings generated.
SAMPLING FOR MODEL 'Rate_5_model' NOW (CHAIN 1).
Iteration: 1 / 10000 0% Iteration: 1000 / 10000 10% Iteration: 2000 / 10000 20% Iteration: 3000 / 10000 30% Iteration: 4000 / 10000 40% Iteration: 5000 / 10000 50% Iteration: 5001 / 10000 50% Iteration: 6000 / 10000 60% Iteration: 7000 / 10000 70% Iteration: 8000 / 10000 80% Iteration: 9000 / 10000 90% Iteration: 10000 / 10000 100%
Elapsed Time: 0.088028 seconds (Warm-up)
0.091544 seconds (Sampling)
0.179572 seconds (Total)
theta 0.50 0.00 0.10 0.31 0.43 0.50 0.57 0.70 1632 1 postpredk1 5.02 0.03 1.88 1.00 4.00 5.00 6.00 9.00 3173 1 postpredk2 4.99 0.03 1.86 1.00 4.00 5.00 6.00 9.00 3026 1 lp__ -15.74 0.01 0.67 -17.65 -15.90 -15.47 -15.30 -15.25 2348 1
Samples were drawn using NUTS(diag_e) at Sat Dec 20 18:23:40 2014. For each parameter, n_eff is a crude measure of effective sample size, and Rhat is the potential scale reduction factor on split chains (at convergence, Rhat=1).