I am using R-INLA to run the following model (Treatment, Animal.1 and Animal.2 are factors and Encounter.Length is continuous):
formula <- Encounter.Length ~ Treatment +f(Animal.1, model = "iid", n = n.animal) +
f(Animal.2, copy = "Animal.1")
m.1 <- inla(formula, data = inla.dat)
However, after running this code I get the following error message:
Error in inla(formula, data = inla.dat) : In f(Animal.1): 'covariate' must match 'values', and both must either be 'numeric', or 'factor'/'character'.
I am new to using INLA and want to know what this error message means and how to fix it.
Answer (from r-inla.help): The levels of B are not a subset of A (which is used to define the model, for which B copies). So you must define the models on the union on the levels.
For example:
This does not work
But this does