model with linear combinations not working

73 views
Skip to first unread message

RobC

unread,
May 24, 2022, 5:13:51 PM5/24/22
to R-inla discussion group
Hi All,

I'm having issues successful running models with linear combinations - my models have run previously (years ago), but i'm getting back to some old code and can't replicate ()or even run!) the model... model without linear combinations work fine - 2 examples below, neither of the models with linear combinations work for me - they just run for hours - any  thoughts welcome,  I'm sure it must be something obvious....

### Dummy data:
set.seed(12)
library(spdep)
library(gstat)
x1 <- runif(100)
x2 <- runif(100)
x3 <- x1 + runif(100)/3
xy <- expand.grid(x = 1:10, y =1:10)
g.dummy <- gstat(formula=z~1, locations=~x+y, dummy=T, beta=1,
                 model=vgm(psill=0.025,model="Exp",range=3), nmax=20)
yy <- predict(g.dummy, newdata=xy, nsim=1)


y  <- x1  + rnorm(100)/2 + yy[,3]
y1  <- x1  + x3 + rnorm(100)/2 + yy[,3]
ID <- 1:100
neighs <-  dnearneigh(as.matrix(xy),  d1 = 0, d2 = 1.5)  #identified neighbours within 1.75km (i.e. queen's case adjacency)
nb2INLA( "dummy.txt", neighs)

dummy.data <- data.frame( y = y, y1 = y1, x1 = c(scale(x1)), x2 = c(scale(x2)),
                          x3 = c(scale(x3)), ID = ID)

x.vals <- seq(min(x2), max(x2), length = 100)
lc <- inla.make.lincombs(x2=cbind(x.vals),"(Intercept)" = cbind(rep(1, 100)))

# model without linear combinations works
test.full <- inla(y ~ x1 + x2 + f(ID, model = "besag", graph = "dummy.txt",
                                      hyper = list(prec = list(prior="pc.prec", param=c(1,0.5)))),
                  family = "gaussian",
                  #                      lincomb = all.lincombs,
                  control.compute = list(dic=TRUE, waic = TRUE),
                  data = dummy.data, control.predictor = list(compute = TRUE))    
summary(test.full)

# model with linear combinations doesn't work
test.full.lc <-  inla(y ~ x1 + x2 + f(ID, model = "besag", graph = "dummy.txt",
                                        hyper = list(prec = list(prior="pc.prec", param=c(1,0.5)))),
                    family = "gaussian",
                    lincomb = lc,
                    control.compute = list(dic=TRUE, waic = TRUE),
                    data = dummy.data, control.predictor = list(compute = TRUE))  

Helpdesk

unread,
May 26, 2022, 6:50:16 AM5/26/22
to RobC, R-inla discussion group
Use the new mode

library(INLA)
inla.setOption(inla.mode = "experimental")
--
You received this message because you are subscribed to the Google Groups "R-inla discussion group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to r-inla-discussion...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/r-inla-discussion-group/d4008f0e-34b9-4f91-9517-e56da472d811n%40googlegroups.com.

--
Håvard Rue
he...@r-inla.org

Helpdesk

unread,
May 26, 2022, 7:24:22 AM5/26/22
to RobC, R-inla discussion group
you example trigger a new condition which leads to an openmp-deadlock,
even when its run in serial. don't know this is due to the new gcc-12
compiler as I have never seen this before. but thanks!!!

RobC

unread,
May 26, 2022, 9:01:35 AM5/26/22
to R-inla discussion group
Thanks Håvard!
I thought it might be a relatively simple fix - hopefully other inla uses will finf the solution beneficial.

Helpdesk

unread,
May 27, 2022, 12:16:29 AM5/27/22
to RobC, R-inla discussion group
this is fixed in the repo, and will appear in the next testing verstion

-----Original Message-----
From: 'RobC' via R-inla discussion group
<r-inla-disc...@googlegroups.com>
Reply-To: RobC <rob.cr...@york.ac.uk>
To: R-inla discussion group <r-inla-disc...@googlegroups.com>
Subject: Re: [r-inla] model with linear combinations not working
Date: Thu, 26 May 2022 06:01:34 -0700 (PDT)

Thanks Håvard!I thought it might be a relatively simple fix - hopefully other inla
Reply all
Reply to author
Forward
0 new messages