Interactions between covariates #195
Raquel-RuizDiaz
started this conversation in
General
Replies: 1 comment 1 reply
-
Interactions should work just fine like that with regular covariates, just not with smooths. This is the same as mgcv, which does the smoother parsing. You can let a smoother interact with another variable in several ways including:
Some references: |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!, I have a fairly easy question:
Is it possible to include interactions between covariates in sdmTMB?
I want to create a delta_gamma model with the following configuration:
fit_dg <- sdmTMB(
biomass ~ 0 + s(temperature) + s(depth),
data = data,
mesh = mesh,
family = delta_gamma(), #< new
spatial = "on",
spatiotemporal = "iid",
time = "year",
silent = FALSE
)
I tried to do it like in a regular GLM changing the following part of the code:
biomass ~ 0 + s(temperature) : s(depth)
and biomass ~ 0 + s(temperature) * s(depth)
none of them worked..
Then, I tried removing the spline and it worked but I got errors:
Warning messages:
1: In stats::nlminb(start = tmb_obj$par, objective = tmb_obj$fn, gradient = tmb_obj$gr, :
NA/NaN function evaluation
2: In stats::nlminb(start = tmb_obj$par, objective = tmb_obj$fn, gradient = tmb_obj$gr, :
NA/NaN function evaluation
So.. I guess it is not possible?
Beta Was this translation helpful? Give feedback.
All reactions