On Mon, 2021-06-07 at 08:51 -0700, Thomas F Johnson wrote:
> I need to account for known correlations between a grouping term in a
> random slope model
>
> Ignoring the known correlations, I can fit a model like so:
> inla(y ~ 1 + f(time, species, model = "ar1"), data = dat)
> where, assuming I'm right (?), I've fit different slopes for the
> temporal term 'time' within each of the grouping terms (species),
> accounting for the first-order autoregressive process.
I'm not sure if you describe this
f(time, model="ar1", replicate=species)
this will give for each 'species', an AR1 in time, wheras the above on,
gives ONE AR1 in time multiplied with species.
[I assume species is numeric 1,2,3 (or as.numeric() if its a factor) ]
>
> However, as species are evolutionarily linked, with varying relation
> (correlation) to one another, I also need to account for the
> similarity in the slopes depending on the species relatedness.
> Something like:
> inla(y ~ 1 + f(time, species, model1 = "ar1", model2 = "generic0",
> Cmatrix = precision_matrix), data = dat)
> where the model1 term accounts for the autoregressive process of time,
> whilst model2 and Cmatrix account for the correlation of slopes
> between species.
depends on 'how many' species' you have
let me know, to many loose ends right now
--
Håvard Rue
he...@r-inla.org