Skip to content

5. Preparing DES model input

Alexander Zizka edited this page Jan 23, 2018 · 3 revisions

The DES model, implemented in PyRate, is a Bayesian method to infer dispersal, extinction and sampling from paleontological data. The model needs a set of replicated input files with the taxon occurrences classified into time-bins and areas. These can easily be derived from two tab-delimited text using speciesgeocodeR. To run the DES model you need: 1) a data.frame of fossil occurrences, including information on the area of occurrence (which you can get from coordinates using SpGeoCod), and the minimum and maximum ages estimated for each occurrence 2) a data.frame with the recent distribution of all taxa in the same areas as for the fossils. Column names follow DarwinCore standard. You can find examples for input data format at ?DESin or here.

##DES input with discrete areas

To account for uncertainty in fossil dating, the DES model uses a set of replicate input files, where in each replicate the fossil ages are randomized between the maximum age ('earliestAge') and minimum age ('latestAge'). Note that, if a taxon occurs in both areas in recent time, it needs a separate row for each area. You can chose the number of replicates with the reps argument of DESin. In the example we will use reps=3, for real analyses usually more replicates (>100) are necessary. The DES model uses a discrete time bins to infer dispersal, extinction and sampling rates, you can set the sizes of these bins (which should is a trade of between the desired resolution and data availability) using the binargument of DESin. The DESinfunction creates an object of the class 'DESin' which you cane explore using plot and summary methods.

library(speciesgeocodeR)

#Create example data
fos <- data.frame(species= rep(letters[1:4],25),
                  earliestAge = runif(100, min = 60, max = 100),
                  latestAge = runif(100, min = 0, max = 60),
                  area = sort(rep(c("A", "B"), 50)))

rec <- data.frame(species = c(letters[1:4], letters[1:2]),
                  area = c(rep("A",4), rep("B", 2)))

#run DESin
exp1 <- DESin(fos, rec, bin.size = 2, reps = 3)

#explore results
summary(exp1)
plot(exp1)

#write to disk to use with PyRate
write.DESin(exp1, file = "Example1_DES_in")