The program 3s (3s.v3.1.tgz) implements the likelihood ratio tests of Yang (2002, 2010) and Zhu & Yang (2012). The latest release (Dalquen et al. 2016) includes several improvements over previous versions:

The previous version is still available here

3s replaces the program Ne3sML (which was included in the MCMCcoal package), which implements the likelihood method of Yang (2002).


You can use 3s as it is, without any additional libraries installed. Use the following command (adapted to your system) to compile the source code:

gcc -O3 -o 3s 3s.c tools.c lfun3s.c -lm

However, we recommend installing the GNU Scientific library (GSL) as this will speed up computation of P(t) significantly, even if you run the program on a single core. Once GSL is installed, you can compile with something like this:

gcc -O3 -DUSE_GSL -o 3s 3s.c tools.c lfun3s.c -lm -lgsl -lgslcblas

Depending on how your system is set up, you might or might not have to specify the location of GSL using the -I and -L options:

gcc -O3 -DUSE_GSL -I/usr/local/include -L/usr/local/lib -o 3s 3s.c tools.c lfun3s.c -lm -lgsl -lgslcblas

Finally, if you want to run 3s on multiple cores, you can compile with OpenMP support:

gcc -O3 -DUSE_GSL -I/usr/local/include -L/usr/local/lib -o 3s -fopenmp 3s.c tools.c lfun3s.c -lm -lgsl -lgslcblas

This should work out-of-the-box on current Linux systems with the GNU tool chain. On Mac OS X and Windows you need a compiler with OpenMP support.

Relevant articles

Yang, Z. 2002 Likelihood and Bayes estimation of ancestral population sizes in Hominoids using data from multiple loci. Genetics 162, 1811-1823.
Yang, Z. 2010. A likelihood ratio test of speciation with gene flow using genomic sequence data. Genome Biology and Evolution 2, 200-211.
Zhu, T., and Z. Yang. 2012. Maximum likelihood implementation of an isolation-with-migration model with three species for testing speciation with gene flow. Molecular Biology and Evolution 29, 3131-3142.
Dalquen, D., Zhu, T., and Yang, Z. 2016. Maximum likelihood implementation of an isolation-with-migration model for three species. Systematic Biology, DOI:10.1093/sysbio/syw063.

Go back to Professor Yang's group web page