Hi all,
Is there a way around a fault I'm getting when using two natural splines, via the ns function. Here's a toy example:
require(splines) ; require(INLA)
set.seed(12344)
x=rnorm(100)
y=rnorm(100)
z=rnorm(100)
data=data.frame(x=x,y=y,z=z)
fml = y ~ ns(x) + ns(z)
mod = inla(formula = fml,data=data)
When this runs, I get:
*** Key [1] is used twice and that is not allowed.
*** A typical example where this happens is: y ~ x + f(x)
*** Change this formula into: y ~ x + f(x2)
*** where you define x2=x
it seems to be something to do with the way that the subset of each spline is fed into the INLA formula, but am currently unsure how to fix it.
Any help would be very welcome.
Thanks a lot.
Robbie