data(plethodon)
### fitting a 3-rate Yule model to the Plethodon data:
result <- yule3rate(plethodon)
### gives data frame with maximum log-likelihood and parameter estimates
### at the max.
### In this case, we would access individual parameters as
### result$LH (the max), result$st1 (first shift time), result$st2
### (the second shift time), and result$r1, result$r2, and result$r3
### for the speciation rates.
### Here we will use 'yule2rate' to output maximum log-likelihoods
### for each shift point considered, then load the file and plot
### log-likelihoods of a rate shift against 'time from basal divergence'
### to graphically explore the tempo of diversification
# result <- yule2rate(plethodon, ints = NULL,
# verbose = TRUE, file = 'out.txt')
# LHtable <- read.table(file = 'out.txt', header = TRUE)
### 'header = TRUE' ensures that variable names are correctly read
### rescaling shift times so that they reflect 'time from basal divergence':
# LHtable$st1 <- plethodon[1] - LHtable$st1
# plot(LHtable$LH~LHtable$st1, xlab = 'Time From Basal Divergence',
# ylab = 'Log-likelihood')
Run the code above in your browser using DataLab