INLA: Fail to get good enough initial values using MOcarolinawren_long example data
jamesdalg opened this issue · comments
library(INLA)
library(dplyr)
library(tidyr)
library(ggplot2)
#install_github("andrewzm/STRbook")
data("MOcarolinawren_long",package="STRbook")
coords<-unique(MOcarolinawren_long[c("loc.ID","lon","lat")])
par(mfrow=c(3,3))
boundary<-inla.nonconvex.hull(as.matrix(coords[,2:3]))
MOmesh <- inla.mesh.2d(boundary = boundary,max.edge = c(5,10),cutoff=3)
plot(MOmesh,asp=1,main="")
spde<-inla.spde2.pcmatern(mesh=MOmesh,alpha=2,prior.range=c(1,0.01),
prior.sigma=c(4,0.01))
A.est<-inla.spde.make.A(mesh=MOmesh,loc=as.matrix(coords[,2:3]))
spde<-inla.spde2.matern(mesh=MOmesh,alpha=2)
simple_nontemporal_formula=y ~ -1 + intercept + f(spatial.field, model=spde)
inla_model=inla(formula = simple_nontemporal_formula,data=list(y=MOcarolinawren_long$cnt, intercept= rep(1,nrow(MOcarolinawren_long)),spatial.field=1:spde$n.spde),control.predictor = list(A=A.est,compute=T) )
Error in inla.core(formula = formula, family = family, contrasts = contrasts, :
MPredictor == ny is not TRUE
*** inla.core.safe: inla.program has crashed: rerun to get better initial values. try=1/2
Error in inla.core(formula = formula, family = family, contrasts = contrasts, :
MPredictor == ny is not TRUE
*** inla.core.safe: inla.program has crashed: rerun to get better initial values. try=2/2
Error in inla.core(formula = formula, family = family, contrasts = contrasts, :
MPredictor == ny is not TRUE
Error in inla.core.safe(formula = formula, family = family, contrasts = contrasts, :
*** Fail to get good enough initial values. Maybe it is due to something else.
This is not the same code supplied with STRbook, which I reran and works on
my machine. For generic questions regarding INLA please consult the INLA
forums.
…On Mon, Nov 14, 2022 at 7:49 PM jamesdalg ***@***.***> wrote:
library(INLA)
library(dplyr)
library(tidyr)
library(ggplot2)
#install_github("andrewzm/STRbook")
data("MOcarolinawren_long",package="STRbook")
coords<-unique(MOcarolinawren_long[c("loc.ID","lon","lat")])
par(mfrow=c(3,3))
boundary<-inla.nonconvex.hull(as.matrix(coords[,2:3]))
MOmesh <- inla.mesh.2d(boundary = boundary,max.edge = c(5,10),cutoff=3)
plot(MOmesh,asp=1,main="")
spde<-inla.spde2.pcmatern(mesh=MOmesh,alpha=2,prior.range=c(1,0.01),
prior.sigma=c(4,0.01))
A.est<-inla.spde.make.A(mesh=MOmesh,loc=as.matrix(coords[,2:3]))
spde<-inla.spde2.matern(mesh=MOmesh,alpha=2)
simple_nontemporal_formula=y ~ -1 + intercept + f(spatial.field, model=spde)
inla_model=inla(formula = simple_nontemporal_formula,data=list(y=MOcarolinawren_long$cnt, intercept= rep(1,nrow(MOcarolinawren_long)),spatial.field=1:spde$n.spde),control.predictor = list(A=A.est,compute=T) )
Error in inla.core(formula = formula, family = family, contrasts = contrasts, :
MPredictor == ny is not TRUE
*** inla.core.safe: inla.program has crashed: rerun to get better initial values. try=1/2
Error in inla.core(formula = formula, family = family, contrasts = contrasts, :
MPredictor == ny is not TRUE
*** inla.core.safe: inla.program has crashed: rerun to get better initial values. try=2/2
Error in inla.core(formula = formula, family = family, contrasts = contrasts, :
MPredictor == ny is not TRUE
Error in inla.core.safe(formula = formula, family = family, contrasts = contrasts, :
*** Fail to get good enough initial values. Maybe it is due to something else.
—
Reply to this email directly, view it on GitHub
<#5>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABEU3IZJJRBBISJZ5ENDPLWIH4K3ANCNFSM6AAAAAAR7SB3OI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>