Plot a smooth term from an sdmTMB model

plot_smooth(
object,
select = 1,
n = 100,
level = 0.95,
ggplot = FALSE,
rug = TRUE,
return_data = FALSE
)

## Arguments

object

An sdmTMB() model.

select

The smoother term to plot.

n

The number of equally spaced points to evaluate the smoother along.

level

The confidence level.

ggplot

Logical: use the ggplot2 package?

rug

Logical: add rug lines along the lower axis?

return_data

Logical: return the predicted data instead of making a plot?

## Details

Note:

• Any numeric predictor is set to its mean

• Any factor predictor is set to its first-level value

• The time element (if present) is set to its minimum value

• The x and y coordinates are set to their mean values

## Examples

d <- subset(pcod, year >= 2000 & density > 0)
pcod_spde <- make_mesh(d, c("X", "Y"), cutoff = 30)
m <- sdmTMB(
data = d,
formula = log(density) ~ s(depth_scaled) + s(year, k = 5),
mesh = pcod_spde
)
#> Warning: Detected a s() smoother. Smoothers are penalized in sdmTMB as
#> of version 0.0.19, but used to be unpenalized.
#> You no longer need to specify k since the degree of wiggliness
#> is determined by the data.
plot_smooth(m)