"length of 'dimnames' [1] not equal to array extent" error when apply inla.posterior.sample()

920 views
Skip to first unread message

lisa C

unread,
Sep 12, 2018, 4:56:28 AM9/12/18
to R-inla discussion group
Dear all,

I have applied the following inla model. In my model, I have 11 covariates and a GMRF spatial random field. I also included a linear combination predictor (mycomb).

M2 <- inla(f2, 
           family = "gaussian",
           lincomb =mycomb,
           data = inla.stack.data(mystack),
           control.compute = list(dic = TRUE, waic = TRUE, 
                                  openmp.strategy="huge",
                                  config = TRUE),
           control.predictor = list(
             A = inla.stack.A(mystack)),
           control.inla = list (lincomb.derived.only = FALSE,
                                strategy = "gaussian", int.strategy = "eb"),
           verbose=TRUE
)

Now I would like to sample from the joint posterior distribution:

mysample <- inla.posterior.sample(n=100, result=M2)

However, I have got the following error:

Error in dimnames(x) <- dn : 
  length of 'dimnames' [1] not equal to array extent

Can someone help me with where i should check the error is? 

Thanks

Chun



Helpdesk

unread,
Sep 12, 2018, 5:03:37 AM9/12/18
to lisa C, R-inla discussion group
can you send me code so I can rerun this here?

thx
H
> --
> 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 post to this group, send email to
> r-inla-disc...@googlegroups.com.
> Visit this group at
> https://groups.google.com/group/r-inla-discussion-group.
> For more options, visit https://groups.google.com/d/optout.

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

Helpdesk

unread,
Sep 12, 2018, 5:06:46 AM9/12/18
to lisa C, R-inla discussion group
On Wed, 2018-09-12 at 01:56 -0700, lisa C wrote:
>
> control.inla = list (lincomb.derived.only = FALSE,

set this to TRUE, or just remove that argument (TRUE is default).
you do not need this, and its a feature that is not recommended for use
any more.

lisa C

unread,
Sep 17, 2018, 8:17:43 AM9/17/18
to R-inla discussion group
Thanks! it works after setting (lincomb.derived.only=TRUE.
Reply all
Reply to author
Forward
0 new messages