In this vignette we demonstrate the usage of skygrowth
on coalescent simulated trees.
We need to load the packages skygrowth
and ape
, and we set the random seed to 0 to make the vignette reproducible.
library(skygrowth) library(ape) set.seed(0)
Let us consider a pathogen population with effective population size times generation time equal to $N_e g=10$ years. A sample of 100 individuals is taken from this population at a single timepoint. The genealogy of such a sample can be simulated as follows:
tree=rcoal(100) tree$edge.length=tree$edge.length*10 plot(tree, show.tip.label = F) axisPhylo(backward = T) mtext("Years since most recent sample", side=1, line=3)
fit=skygrowth.map(tree,quiet=T) cat('Drift parameter tau: ',fit$tau) growth.plot(fit) plot(fit,logy=F)
fit2=skygrowth.mcmc(tree,quiet=T) growth.plot(fit2) plot(fit2,logy=F) plot(fit2$tau,type='l',ylab='tau',xlab='Iterations')
fit3=skygrowth.mcmc(tree,quiet=T,tau_logprior = function(x) dexp(x, 0.1, log=T)) growth.plot(fit3) plot(fit3,logy=F) plot(fit3$tau,type='l',ylab='tau',xlab='Iterations')
library(mlesky) fit4=mlskygrid(tree) plot(fit4,logy=F)
library(phylodyn) fit5=BNPR(tree) plot_BNPR(fit5,log = '')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.