plot_pred_by_term: Spatially plot predictions per model term

View source: R/plot_pred_by_term.R

plot_pred_by_termR Documentation

Spatially plot predictions per model term

Description

Plot the effect of each smooth in the model spatially. For each term in the model, plot its effect in space. Plots are made on the same scale, so that the relative influence of each smooth can be seen.

Usage

plot_pred_by_term(dsm.obj, data, location.cov = c("x", "y"))

Arguments

dsm.obj

fitted dsm object

data

data to use to plot (often the same as the prediction grid), data should also include width and height columns for plotting

location.cov

deprecated, use location.cov

Value

a ggplot2 plot

Author(s)

David L Miller (idea taken from inlabru)

Examples

## Not run: 
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()

## End(Not run)

dsm documentation built on Aug. 21, 2022, 1:07 a.m.