if (FALSE) {
library(Distance)
library(dsm)
# load the Gulf of Mexico dolphin data and fit a model
data(mexdolphins)
hr.model <- ds(distdata, truncation=6000,
key = "hr", adjustment = NULL)
mod1 <- dsm(count~s(x,y) + s(depth), hr.model, segdata, obsdata)
preddata$width <- preddata$height <- sqrt(preddata$area)
# make the plot
plot_pred_by_term(mod1, preddata, c("x","y"))
# better plot would be
# library(viridis)
# plot_pred_by_term(mod1, preddata, c("x","y")) + scale_fill_viridis()
}
Run the code above in your browser using DataLab