MetaPopGen is a population genetics simulator. Features included in the model are age-structure, monoecious and dioecious (or separate sexes) life-cycles, mutation, dispersal and selection. All demographic parameters can be genotype-, sex-, age-, deme- and time-dependent. MetaPopGen is therefore indicated to study large populations and very complex demographic scenarios.

To cite MetaPopGen, please use:

Andrello M and Manel S. (2015). MetaPopGen: an R package to simulate population genetics in large size metapopulations. Molecular Ecology Resources, 15: 1153-1162, DOI: 10.1111/1755-0998.12371.


1. Download the desired version from the list at the end of this page

2. MetaPopgen is currently distributed as a source package. As with all R packages, installing the package from source files requires that all the dependent libraries are installed before .MetaPopGen depends on the following libraries, which I suggest that you install before trying to install MetaPopGen:

 - BiasedUrn

 - sp

 - lattice


3. Install MetaPopGen by typing in the R console:


(replace the 0.0.1 with the actual version of the package)

Getting started

1. Once MetaPopgen is installed, load the library:


2. To get help and see how the program works, I have written a detailed user guide that you can acces by typing:



Tutorial 1

Tutorial 2


Version history

0.0.6 2016 December
 - fixed a few mistakes in the manual files
 - various minor adjustments (following La Paz's class)
 - Using constant dispersal matrices is more memory-efficient

0.0.5 2016 June
 - added functions to calculate Weir&Cockerham's theta estimator of FST
 - added a funciton to simulate coral genetics (one stage class)

0.0.4, 2015 November 30th
 - solved an issue that caused an error when using large fecundities

0.0.3, 2015 July 13th
 - corrected a bug in fecundity calculation that led to underestimation of fecundity

0.0.2, 2015 January 8th
 - added stochastic fecundity: now fecundity is modeled as a Poisson process

0.0.1, 2014 November 26th
- included number of years of simulations (T_max) as an explicit argument to the function and not as a parameter calculated from the size of the demographic parameters. This allows for the following option...
- ....option to define time-invariant demographic parameters without having to multiplicate the same array for all years of simulations
- included the argument save.res.T that defines the time steps for which results are saved, when they are saved on disk (save.res = T)

0.0.0, 2014 October 10th
Marco Andrello,
Dec 17, 2014, 1:26 AM
Marco Andrello,
Jan 8, 2015, 9:38 AM
Marco Andrello,
Jul 13, 2015, 1:02 AM
Marco Andrello,
Nov 30, 2015, 12:39 AM
Marco Andrello,
Jun 27, 2017, 7:51 AM
Marco Andrello,
Jun 27, 2017, 7:51 AM
Marco Andrello,
Jun 27, 2017, 8:00 AM
Marco Andrello,
Jun 27, 2017, 8:00 AM