it was encountered when I try to run:stk.y2 <- inla.stack(data=list(Biomass_Pos=y, #for the single model alldata=cbind(y, NA), link=1), #for the joint model
A=list(A.2, 1),
effects=list(list(y.field=ind.2),
list(rep(data.frame(y.intercept=1,covars),nrepl.2))),
tag="est.y")
(Please use the RCode uploaded in this post as in the previous version this object was names stk.y instead of stk.y2 (sorry about that). However, this didn’t of course affect the call to inla.stack() as I could not move on with the code anyway. But I have corrected it for using it in the joint stack ‘stk.yz2’)
When I built new separate stacks with only amount or occurrence (i.e., not combined c(y,NA) or c(NA,z) in each of the separate stacks) and no joint stack of course in the end, these work well throwing no errors and calls to inla execute without any problems.
stk.y2 <- inla.stack(data=list(Biomass_Pos=y),
A=list(A.2, 1),
effects=list(ind.2,
list(data.frame(y.intercept=1,covars))),
tag="est.y")
stk.z2 <- inla.stack(data=list(Biomass_PrAb=z),
A=list(A.2, 1),
effects=list(ind.2,
list(data.frame(z.intercept=1,covars))),
tag="est.z")
However, when I try to create stacks like the ones below, I cannot understand what needs to be placed in the respective y and z fields. Moreover, I am not sure if in the list of effects the intercept+covariates data frame should have only one instance or it should be replicated (x times the n.repl) so as the number of rows to match…
stk.y3 <- inla.stack(data=list(Biomass_Pos=y, #for the single model
alldata=cbind(y, NA), link=1), #for the joint model
A=list(A.2, 1),
effects=list(list(y.field=.........),
list(data.frame(y.intercept=1,covars))),
tag="est.y")
stk.z3 <- inla.stack(data=list(Biomass_PrAb=z, #for the single model
alldata=cbind(NA, z) , link=2), #for the joint model
A=list(A.2, 1),
effects=list(list(z.field=..........,
zc.field=..........),
list(data.frame(z.intercept=1,covars))),
tag="est.z")
For stk.y3, if I use the following formulation I get no error
stk.y3 <- inla.stack(data=list(Biomass_Pos=y, #for the single model
alldata=cbind(y, NA), link=1), #for the joint model
A=list(A.2, 1),
effects=list(ind.2,
list(data.frame(y.intercept=1,covars))),
tag="est.y")
and the use of
formula.y3 <- Biomass_Pos ~ -1 + y.intercept + Ttop50.std + Stop50.std +
f(s, model=spde.a, replicate=s.repl)
out.y3 <- inla(formula.y3, family="gamma", data=inla.stack.data(stk.y3),
control.predictor=list(A=inla.stack.A(stk.y3), compute=TRUE, link=1),
control.compute=list(dic=TRUE, waic=TRUE, config=T))
works fine (meaning it does not throw errors)
BUT doing the same for
stk.z3 <- inla.stack(data=list(Biomass_PrAb=z, #for the single model
alldata=cbind(NA, z), link=2), #for the joint model
A=list(A.2, 1),
effects=list(list(z.field=ind.2,
zc.field=ind.2),
list(data.frame(z.intercept=1,covars))),
tag="est.z")
throws:
Error in rbind(deparse.level, ...) :
numbers of columns of arguments do not match
so I cannot move on to creating a joint stack and running the joint model.
Cheers,
Nikos