You have to do this without stack, essentially. start easier, make the
mesh nodes at the observational location so you can bypass the A-matrix.
which this works, you can add that in if you like.
On Fri, 2024-01-05 at 04:29 -0800, TheCorinna1994 wrote:
> Thank you for your answer.
> Maybe one last question: I defined a stack for each dataset according
> to
https://becarioprecario.bitbucket.io/spde-gitbook/ch-manipula.html
>
> stack_rain_early<-
> inla.stack(data=list(predictor=cbind(data.rain$Rain_max,NA,NA)),
> A=list(A_rain_early),
> effects=list(c(index_rain,
> list(Intercept1=1))),
> tag="rain_stack_early" )
>
> stack_temp_early<-inla.stack(data=list(predictor2=cbind(NA,
> data.temp$Temp_mean, NA)),
> A=list(A_temp_early),
> effects=list(c(index_temp, index_rain_copy
> ,list(Intercept2=1))),
> tag="temp_stack_early")
>
> stack_stations_early<-inla.stack(data=list(predictor=cbind(NA,NA,
> data.mon$Rain_max)),
> A=list(A_stations_early,1),
> effects=list(c(index_max, index_temp_copy,
> index_rain_copy2,list(Intercept3=1)),
> list(covars.data_early)),
> tag="stations_stack_early")
>
> stack_all_early<-inla.stack(stack_rain_early,stack_temp_early,
> stack_stations_early)
>
> Then I define different spread and tail parameters (for the rain
> dataset I do not have elevation dependencies):
>
> n.rain.early<-length(data.rain$Rain_max)
> null.matrix_early<-matrix(nrow=n.rain_early, ncol=0)
> spread.x.rain_early<-null.matrix_early
> tail.x.rain_early<-null.matrix_early
>
> spread.x_early<-data.mon$Elevation
> tail.x_early<-data.mon$Elevation
>
> and I rewrite the formula
>
> formula4_max<-list(inla.mdata(predictor, spread.x.rain_early,
> tail.x.rain_early),predictor,inla.mdata(predictor, spread.x_early,
> tail.x_early)) ~-1+ Intercept1+Intercept2+Intercept3+
> f(field_rain, model=spde.nonstat, group = field_rain.group,
> control.group = list(model="ar1", hyper=rho))+
> f(field_temp, model=spde.nonstat, group = field_temp.group,
> control.group = list(model="ar1", hyper=rho))+
> f(field_max, model=spde.nonstat, group = field_max.group,
> control.group = list(model="ar1", hyper=rho))+
> f(field_rain_copy,copy="field_rain", group = field_rain_copy.group,
> fixed=FALSE, hyper=hyper)+
> f(field_rain_copy2, copy="field_rain", group =
> field_rain_copy2.group, fixed=FALSE, hyper=hyper)+
> f(field_temp_copy, copy="field_temp", group = field_temp_copy.group,
> fixed=FALSE, hyper=hyper)
>
> but the error is now: Error in inla.core(formula=formula,
> family=family, contrasts=contrasts, : MPredictor==ny is not TRUE
>
> I thought I deconstructed the stacks already.... maybe you have a
> quick answer. Otherwise I appreciate your help and would wait for more
> information at some later point.
>
> All the best,
> Corinna
he...@r-inla.org