Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESS for combined chains correct? #15

Closed
richelbilderbeek opened this issue May 11, 2018 · 7 comments
Closed

ESS for combined chains correct? #15

richelbilderbeek opened this issue May 11, 2018 · 7 comments

Comments

@richelbilderbeek
Copy link
Member

From @thijsjanzen:

Babette is echt superhandig om de ESS te berekenen, en lijkt ook wel sneller te zijn dan tracer. Wat me wel opviel is dat de ESS waarden exact overeenkomen met tracer, behalve voor 'combined'.

Ik run vaak 10 onafhankelijke BEAST chains, en plak deze dan aan elkaar om 1 grote chain te krijgen. Zo weet je zekerder dat je niet in een lokaal optimum zit. Om te checken dat de chains allemaal naar hetzelfde convergeren, is het handig om de ESS van de gecombineerde chain te checken. Nu zag ik alleen dat deze ESS waarden niet overeenkomen met die van tracer. 

Het mooiste zou nu natuurlijk zijn als ik een user-case zou meegeven, maar de log files zijn wat groot om te demonstreren hier. Ik vermoed dat je deze situatie ook makkelijk zelf kan repliceren.

@richelbilderbeek
Copy link
Member Author

Requested for use case on simple data. I have only inexact ideas what combined chains are.

@richelbilderbeek
Copy link
Member Author

@thijsjanzen will try to create a simple usecase 👍

@thijsjanzen
Copy link

I have a simple user case here.
Surprisingly, it appears to work as intended, no problems here. Darn. That means that in my previous analysis, I did something wrong, rather than blaming poor babette!

`#devtools::install_github("richelbilderbeek/babette")

library(babette)
library(beastier)

#beastier::install_beast2()

setwd("/Users/janzen/MEGAsync/CARL/test_beast/")

all_chains <- c()
found_ESS <- c()
for(i in 1:5) {
cat(i, "\n")
bbt_run(
fasta_filenames = get_babette_path("anthus_aco.fas"),
mcmc = create_mcmc(chain_length = 2000000, store_every = 5000),
rng_seed = i,
beast2_output_log_filename = paste0("log_",i,".log"),
cleanup = FALSE
)

beast_log_full <- parse_beast_log(paste0(getwd(),"/log_",i,".log"))
beast_log <- remove_burn_ins(beast_log_full,
burn_in_fraction = 0.1)

found_ESS[i] <- calc_ess(beast_log$posterior, sample_interval = 5000)
all_chains <- c(all_chains, beast_log$posterior)
}

this should be (following tracer on the log files)

1362, 1285, 1618, 1345, 1546

found_ESS

and this should be:

7502

calc_ess(all_chains, sample_interval = 5000)
`

@richelbilderbeek
Copy link
Member Author

Happy to hear. I do test babette to have exactly the same results as Tracer, but not on combined chains. But well, if it all works correctly, there is no need to add a test.

Thanks for confirming babette also works as intended on combined chains!

@richelbilderbeek
Copy link
Member Author

Will close this Issue, unless @thijsjanzen has some concluding words of wisdom 🌈 ?

@thijsjanzen
Copy link

Always provide a solid user case!

@richelbilderbeek
Copy link
Member Author

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants