Comments (5)
That final sample is to compute DIC, is my guess. If so, there's no harm in it.
That said, I get no divergent iterations for the example you provide.
from rethinking.
however when I directly check for divergences I see 0
,
> divergent <- get_sampler_params(test@stanfit, inc_warmup=FALSE)[[1]][,'divergent__']
> sum(divergent)
[1] 0
I was lead here by another case where 1
divergence was reported. When I check directly, no divergence. When I look for any sign of the divergence in the stanfit
object I can find none.
from rethinking.
I've run into the same issue. Below is code that triggers a warning that there was 1 divergent transition after warmup, but the "divergent" function says that there were none.
library(rethinking)
set.seed(123)
# create some fake data for a few different groups
result <- data.frame()
for (i in 1:20)
{
rand_temp <- sample.int(10,1)
temp <- data.frame(group=rep(i, rand_temp*5), sample=rnorm(rand_temp*5, ifelse(i %in% c(1,2,3),3,0), 1))
print(temp)
result <- rbind(result, temp)
}
# model specification
model_spec <- alist(
sample ~ dnorm(mu[group], sigma),
mu[group] ~ dnorm(a, b),
sigma ~ dcauchy(0, 2.5),
a ~ dnorm(0, 5),
b ~ dcauchy(0, 50)
)
# feed the model to stan
mod_obj <- map2stan(model_spec, data = result, iter=10000, control = list(adapt_delta = 0.99))
divergent(mod_obj)
from rethinking.
This is just the DIC sample taken after real sampling finishes. The way DIC is calculated is to compute the posterior mean and then pass it back into the model to get the deviance.
In the Experimental branch, DIC is disabled by default, I think. I have also phased it out in the new ulam() tool.
from rethinking.
Oh, I see. Thank you very much for clearing that up! And thanks for this great package.
(By the way, DIC must not be disabled for the Experimental branch, since I got the same message after installing that version.)
from rethinking.
Related Issues (20)
- Ulam/cmdstan errors HOT 11
- processx error with ulam() HOT 5
- Multivariate linear ecological community models
- ulam: save> and log_lik clash with one another HOT 1
- 2nd edition errata: p. 445, discussion of Fig. 14.5 describes 1st edition Fig. 13.5
- Feature request: Add a template for shifted lognormal distribution HOT 2
- Does the rethinking package work using the newest version of R - 4.2.2? HOT 1
- Nevermind HOT 2
- Eliminating variable breaks ulam model HOT 2
- Smooth functions of a variable - modeling syntax HOT 2
- Problem with R code 9.14 on Mac OS
- problems loading rethinking HOT 1
- Zero Inflated Negative Binomial Model HOT 1
- difference in n_eff of population mean depending on model specification HOT 3
- Comparison length > 1 in `cv_data_slice`.
- character limit in translating to stan with ulam()? HOT 3
- Problem with defining imputed variable as a vector in generated stan code HOT 2
- link() not handling id variable values not in original data HOT 2
- Gamma parameterisation
- sim() from model with missing value imputation breaks with error "function merge_missing not found" HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rethinking.