# specify an inhomogeneous rate of new infections
lambda<- c(rep(0.2,10), rep(0.1,10)) # twice as infectious in the first half of the
# infectious period, with a mean number of 3 secondary cases
## Create a simulated outbreak
epirecord<-maketranstree(lambda,duration=2,NumCases=30)
## Extract the genealogy as a phylo4 object
simgeneal<-getgenealogy(epirecord)
# Intermediate functions:
# creates the phylo4 object from a list of edges and lengths.
# makephylotree(Edges,Lengths,Root)
sortmyepi(epirecord) # sorts the rows of the simulated epidemic
Run the code above in your browser using DataLab