Estimating standard deviation when using multithreaded nested sampling

254 views
Skip to first unread message

Magnus Nygård Osnes

unread,
May 9, 2019, 4:46:52 AM5/9/19
to beast-users
Hi,

I am a bit confused as to how to calculate the standard deviation when using multithreaded nested sampling. I have been using nested sampling for selecting between demographic models and molecular clock models when estimating time-dated phylogenies. Since the datasets I have are quite large it is necessary to use multithreaded nested sampling to reduce computation time e.g. with settings:

"<run id="mcmc" spec="beast.gss.MultiThreadedNS" threads="4" chainLength="100000000" particleCount="1" subChainLength="5000" epsilon="1e-12">".
The output from a multinest typically look like:

"
Finished in 2365 steps!
Marginal likelihood: -14132.965225427695 (bootstrap SD=34.2166982748555)
Marginal likelihood: -14128.649214723318 (subsample SD=41.66789769575494)
Marginal likelihood: -14134.08096175106(32.94622891466074)
Information: 1182.1919677046953
SD: 34.38301859500843
"

So it says that the estimate of the standard deviation is ≈ 34.38 But shouldn't it be: SD = sqrt( Information / number of active points) =  sqrt( 1182 / 4) = 17.19? 
- Since I ran 4 threads with 1 active point that should give me 4 active points?


Thanks in advance, 
Magnus

Remco Bouckaert

unread,
May 13, 2019, 4:37:32 PM5/13/19
to beast...@googlegroups.com
Hi Magnus,

You are right that the SDs reported at the end of the run are the SD estimates for the individual threads, so you should have 4 estimates reported with 4 threads. Probably the best way to think of an n-thread MultiThreadedNS analysis is as if they were n individual NS analyses.

The individual SD estimates have relative high variance, so to get a better estimate of the SD it is better to include all 4 runs than just a single estimate.

You can do this by running the NSLogAnalyser app that is part of the NS package, like so:

/path/to/applauncher NSLogAnalyser -N 1 -noposterior -log 0tracelog.log 1tracelog.log 2tracelog.log 3tracelog.log

of the shorter

/path/to/applauncher NSLogAnalyser -N 1 -noposterior -log ?tracelog.log

where "-N 1” indicates there is 1 particle per thread, and “?tracelog.log” assumes your log file is called “tracelog.log”. MultiThreadedNS will create one trace log file for each thread called “0tracelog.log”, “1tracelog.log”, etc. so you want to include all of these. ML and SD estimates will be printed based on all the MultiThreadedNS runs.

Hope this helps,

Remco


--
You received this message because you are subscribed to the Google Groups "beast-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beast-users...@googlegroups.com.
To post to this group, send email to beast...@googlegroups.com.
Visit this group at https://groups.google.com/group/beast-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/beast-users/b30bdbd8-d0a1-4b19-83bb-c85431ffce8e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Magnus Nygård Osnes

unread,
May 15, 2019, 5:58:25 AM5/15/19
to beast...@googlegroups.com
Thanks, this was exactly what I was looking for. But unfortunately, I am using MacOS and don't have access to any Linux system atm. When I try passing the arguments you suggested to the executable "/Applications/BEAST 2.5.1/AppLauncher.app/Contents/MacOS/JavaAppLauncher", it opens the "AppLauncher" and doesn't recognize the arguments. Do you have a solution for the MacOS systems as well? (I know the solution should be quite similar, but I am quite inexperienced with the terminal on mac - sorry). The GUI of Nested sampling log analyzer works fine, but that doesn't take multiple log files. 

Thanks again for your help, 
Magnus


Remco Bouckaert

unread,
May 15, 2019, 2:08:39 PM5/15/19
to beast...@googlegroups.com
Hi Magnus,

The app launcher on OS X is in the bin directory of BEAST, so with v2.5.1, you should be able to start it on a terminal using

/Applications/BEAST\ 2.5.1/bin/applauncher -N 1 -noposterior -log ?tracelog.log

Cheers,

Remco

Remco Bouckaert

unread,
May 15, 2019, 3:36:24 PM5/15/19
to beast...@googlegroups.com
Forgot to include the `NSLogAnalyser` as argument.  It should be:

/Applications/BEAST\ 2.5.1/bin/applauncher NSLogAnalyser -N 1 -noposterior -log ?tracelog.log

Remco

Dylan O'Hearn

unread,
Aug 14, 2022, 3:41:03 PM8/14/22
to beast-users
I'm having the same problem, I can launch the app through the command prompt (Windows) but it doesn't recognize any commands.  Is there perhaps another way to combine the multiple log files? 

Pavel Rinkman

unread,
Aug 15, 2022, 7:56:32 AM8/15/22
to beast-users
I have just tried the analyser on Windows & it works. Could you show your command?

воскресенье, 14 августа 2022 г. в 22:41:03 UTC+3, dylanj...@gmail.com:

Dylan O'Hearn

unread,
Aug 21, 2022, 3:59:47 PM8/21/22
to beast-users
Hi Pavel,

I first navigated to the folder containing the log files and used the following command taken straight from the github page

/path/to/applauncher NSLogAnalyser -N 1 -noposterior -log 0all.log 1all.log 2all.log

I also tried it with "?all.log" instead.  And of course the path I used was appropriate for my directories.  I know that it was able to launch, because if I only entered

/path/to/applauncher NSLogAnalyser

it would successfully launch the GUI.  But when I entered the full command including the log files, nothing would happen, except the cursor would briefly change to indicate waiting/processing, but with no result.  I also tried it with my working directly where the applauncher was and using the full path to the log files, with the same result. 

Pavel Rinkman

unread,
Aug 21, 2022, 6:07:48 PM8/21/22
to beast-users

Hello Dylan,

I have a suspicion that either you have too many particles that takes a ton of time or your console window shows you not all streams. Could you try this command, await the prompt appearance & put the output file content here? Otherwise, it is hard to help with anything without logs.

path-to\BEAST.v2.6.6.Windows\BEAST\bat\applauncher NSLogAnalyser -noposterior -N 1 -log .\ ?all.log *>&1 | tee .\all.NSA.log

Best,
Pavel

воскресенье, 21 августа 2022 г. в 22:59:47 UTC+3, dylanj...@gmail.com:
Reply all
Reply to author
Forward
0 new messages