OK,
now I see more what you're trying to do. The issue is that the "copy"
feature only works if the "main" model takes the same inputs as the
"copy".
In your specification,
species(sp_id, model = "iid2d", n = 2*N) +
maxT1(geometry, rasters$max_temp, copy = "species")
where maxT1 is a spatially indexed model with spatial weights given by
the max_temp raster. But species is not a spatially indexed model, so
that won't work.
In the thread you linked they're doing something else, so it can't be
used as a blueprint here.
If all you want is to have different linear covariate effects for each
species, I believe you could do something like this:
geometry + sp_id ~ 0 +
Species_Intercept(sp_id, model="iid") +
maxT(rasters$max_temp, model="linear", group=sp_id,
control.group=list(model="exchangeable")) +
degDay(...) +
...
and so on for each spatial covariate. Since your model will need to
have point pattern intensity lambda(space, species) (different
intensity for each species), you'll need
domain=list(geometry=mesh, sp_id=seq_len(N))
in the lgcp() call.
The above approach can be combined with having a "common effect" of
each covariate as well, but for spatially constant effects that
probably wouldn't make much of a difference to the estimates.
Add
+ field(geometry, model=spde)
for a common random field effect, or do the same with that one;
+ field(geometry, model=spde, group=sp_id, ...)
Optionally, you could try
+ common_field(geometry, model=spde_common) +
species_field(geometry, model=spde_species, group=sp_id, ...)
where optionally you'd have used constr=TRUE when creating
spde_species, to force an integrate-to-zero constraint, which might
help with identifiability against the common_field component (but only
globally; they wouldn't be identifiable locally, so might have to be
very specific with how you set the priors for the correlation range to
nudge the components to capture what you want them to be able to
capture.
Finn
On Thu, 11 Jul 2024 at 13:39, 'Gabrielle Koerich' via R-inla
> To view this discussion on the web, visit
https://groups.google.com/d/msgid/r-inla-discussion-group/e79da9a6-61cb-47af-96a4-e555c9780968n%40googlegroups.com.