#plot a likelihood surface for the plethodon dataset
data("plethodon")
rvector <- seq(.001, .04, length.out = 100)
avector <- seq(0, 0.99, length.out = 100)
#calculating likelihoods:
lmatrix <- matrix(0, length(rvector), length(avector))
for (i in 1:length(rvector)){
for (j in 1:length(avector)){
lmatrix[i,j] <- calcLHbd(plethodon, rvector[i], avector[j])
}
}
#Now to plot surface:
lmax <- max(lmatrix) #maximum calculated LH
filled.contour(rvector, avector, lmatrix,
levels = seq(lmax-5, lmax, length.out = 20),
col = heat.colors(20), xlab = "Net Diversification Rate",
ylab = "Extinction Fraction", key.title = title("Log-LH"))
# plots the surface. See ?filled.contour for help on this plotting function.
Run the code above in your browser using DataLab