out
Inference for Stan model: mod_occupancy_simple.
6 chains, each with iter=5000; warmup=1000; thin=1;
post-warmup draws per chain=4000, total post-warmup draws=24000.
mean se_mean sd 2.5% 25% 50% 75% 97.5% n_eff Rhat
psi 0.3 0 0.2 0 0.2 0.2 0.4 0.8 24000 Inf
p 0.7 0 0.3 0 0.5 0.8 0.9 1.0 24000 8.020037e+15
lp__ -Inf NaN NaN -Inf -Inf -Inf -Inf -Inf 24000 NaN
Samples were drawn using NUTS(diag_e) at Thu Jan 02 11:58:49 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).
out2
Inference for Stan model: mod_occupancy_simple.
6 chains, each with iter=50000; warmup=1000; thin=1;
post-warmup draws per chain=49000, total post-warmup draws=294000.
mean se_mean sd 2.5% 25% 50% 75% 97.5% n_eff Rhat
psi 0.5 0 0.3 0.1 0.3 0.5 0.8 0.8 294000 Inf
p 0.5 0 0.3 0.0 0.2 0.6 0.8 0.9 294000 9.833529e+15
lp__ -Inf NaN NaN -Inf -Inf -Inf -Inf -Inf 294000 NaN
Samples were drawn using NUTS(diag_e) at Thu Jan 02 11:50:26 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).I tried simplifying further by removing the covariates. Now there are only two parameters to estimate, occupancy and detection probability. Estimates coming out of RStan seem pretty off, n_effective = the number of samples drawn, and R_hat is huge. At the very least, there seems to be something wrong with how the convergence diagnostics are being calculated, so I can't tell if I'm sampling the posterior distributions adequately. Longer chains don't seem to be bringing down the R hat or making the estimates look any better. Code for simplified model without covariates is below. Any ideas on what I am doing wrong would be appreciated.
library(rstan)
set_cppo("fast") # for best running speed
#set_cppo("debug") # for best running speed# Set values for simulating data
p <- 0.7 #Values for p at intercept (mean of covariate values)
psi <- 0.5 #Values for psi at intercept (mean of covariate value(s))
n.site <- 1000 #no. sites
n.visit <- 2 #no. visits (will try n.visit<-c(5,10,20,40) for n.site = 30 and p = 0.1 later)
# Function for simulating data
expit <-
function(x){
exp(x)/(1+exp(x))
}logit <-
function(x){
log(x/(1-x))
}
--
You received this message because you are subscribed to the Google Groups "stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
TRANSLATING MODEL 'mod_occupancy_simple' FROM Stan CODE TO C++ CODE NOW.
COMPILING THE C++ CODE FOR MODEL 'mod_occupancy_simple' NOW.
cygwin warning:
MS-DOS style path detected: C:/PROGRA~1/R/R-30~1.1/etc/x64/Makeconf
Preferred POSIX equivalent is: /cygdrive/c/PROGRA~1/R/R-30~1.1/etc/x64/Makeconf
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
C:/Program Files/R/R-3.0.1/library/rstan/include//stansrc/stan/agrad/rev/var_stack.hpp:49:17: warning: 'void stan::agrad::free_memory()' defined but not used [-Wunused-function]
SAMPLING FOR MODEL 'mod_occupancy_simple' NOW (CHAIN 1).
Iteration: 5000 / 5000 [100%] (Sampling)
Elapsed Time: 0.533 seconds (Warm-up)
1.963 seconds (Sampling)
2.496 seconds (Total)
SAMPLING FOR MODEL 'mod_occupancy_simple' NOW (CHAIN 2).
Iteration: 5000 / 5000 [100%] (Sampling)
Elapsed Time: 0.503 seconds (Warm-up)
1.755 seconds (Sampling)
2.258 seconds (Total)
SAMPLING FOR MODEL 'mod_occupancy_simple' NOW (CHAIN 3).
Iteration: 5000 / 5000 [100%] (Sampling)
Elapsed Time: 0.518 seconds (Warm-up)
1.747 seconds (Sampling)
2.265 seconds (Total)
SAMPLING FOR MODEL 'mod_occupancy_simple' NOW (CHAIN 4).
Iteration: 5000 / 5000 [100%] (Sampling)
Elapsed Time: 0.503 seconds (Warm-up)
1.734 seconds (Sampling)
2.237 seconds (Total)
SAMPLING FOR MODEL 'mod_occupancy_simple' NOW (CHAIN 5).
Iteration: 5000 / 5000 [100%] (Sampling)
Elapsed Time: 0.52 seconds (Warm-up)
1.873 seconds (Sampling)
2.393 seconds (Total)
SAMPLING FOR MODEL 'mod_occupancy_simple' NOW (CHAIN 6).
Iteration: 5000 / 5000 [100%] (Sampling)
Elapsed Time: 0.505 seconds (Warm-up)
1.763 seconds (Sampling)
2.268 seconds (Total)
> out
Inference for Stan model: mod_occupancy_simple.
6 chains, each with iter=5000; warmup=1000; thin=1;
post-warmup draws per chain=4000, total post-warmup draws=24000.
mean se_mean sd 2.5% 25% 50% 75% 97.5% n_eff Rhat
psi 0.5 0 0 0.5 0.5 0.5 0.6 0.6 16893 1
p 0.7 0 0 0.6 0.7 0.7 0.7 0.8 16380 1
lp__ -287.5 0 1 -290.1 -287.9 -287.2 -286.8 -286.6 10545 1
Samples were drawn using NUTS(diag_e) at Sun Jan 05 10:29:05 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).TRANSLATING MODEL 'mod_occupancy_simple' FROM Stan CODE TO C++ CODE NOW.
COMPILING THE C++ CODE FOR MODEL 'mod_occupancy_simple' NOW.
cygwin warning:
MS-DOS style path detected: C:/PROGRA~1/R/R-30~1.1/etc/x64/Makeconf
Preferred POSIX equivalent is: /cygdrive/c/PROGRA~1/R/R-30~1.1/etc/x64/Makeconf
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
C:/Program Files/R/R-3.0.1/library/rstan/include//stansrc/stan/agrad/rev/var_stack.hpp:49:17: warning: 'void stan::agrad::free_memory()' defined but not used [-Wunused-function]
SAMPLING FOR MODEL 'mod_occupancy_simple' NOW (CHAIN 1).
Iteration: 2000 / 2000 [100%] (Sampling)
Elapsed Time: 2.604 seconds (Warm-up)
2.148 seconds (Sampling)
4.752 seconds (Total)
SAMPLING FOR MODEL 'mod_occupancy_simple' NOW (CHAIN 2).
Iteration: 2000 / 2000 [100%] (Sampling)
Elapsed Time: 2.554 seconds (Warm-up)
2.452 seconds (Sampling)
5.006 seconds (Total)
SAMPLING FOR MODEL 'mod_occupancy_simple' NOW (CHAIN 3).
Iteration: 2000 / 2000 [100%] (Sampling)
Elapsed Time: 2.764 seconds (Warm-up)
2.238 seconds (Sampling)
5.002 seconds (Total)
SAMPLING FOR MODEL 'mod_occupancy_simple' NOW (CHAIN 4).
Iteration: 2000 / 2000 [100%] (Sampling)
Elapsed Time: 2.553 seconds (Warm-up)
2.429 seconds (Sampling)
4.982 seconds (Total)
SAMPLING FOR MODEL 'mod_occupancy_simple' NOW (CHAIN 5).
Iteration: 2000 / 2000 [100%] (Sampling)
Elapsed Time: 2.585 seconds (Warm-up)
2.431 seconds (Sampling)
5.016 seconds (Total)
SAMPLING FOR MODEL 'mod_occupancy_simple' NOW (CHAIN 6).
Iteration: 2000 / 2000 [100%] (Sampling)
Elapsed Time: 2.606 seconds (Warm-up)
2.291 seconds (Sampling)
4.897 seconds (Total)
> out
Inference for Stan model: mod_occupancy_simple.
6 chains, each with iter=2000; warmup=1000; thin=10;
post-warmup draws per chain=100, total post-warmup draws=600.
mean se_mean sd 2.5% 25% 50% 75% 97.5% n_eff Rhat
psi_mean 0.5 0.0 0.0 0.4 0.5 0.5 0.5 0.6 600 1
p_mean 0.7 0.0 0.0 0.6 0.7 0.7 0.7 0.8 600 1
B0 0.0 0.0 0.2 -0.3 -0.1 0.0 0.1 0.3 600 1
B_x1 1.0 0.0 0.2 0.6 0.8 1.0 1.1 1.4 600 1
B_x2 -0.1 0.0 0.2 -0.4 -0.2 -0.1 0.0 0.2 600 1
A0 1.0 0.0 0.2 0.6 0.8 0.9 1.1 1.4 600 1
A_x1 -0.1 0.0 0.2 -0.4 -0.2 -0.1 0.0 0.3 592 1
lp__ -262.5 0.1 1.5 -266.3 -263.3 -262.2 -261.4 -260.6 600 1
Samples were drawn using NUTS(diag_e) at Sun Jan 05 12:08:04 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).