Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Specifying separate precision parameters for different groups - Spatial Model.

37 views
Skip to first unread message

Eamonn o

unread,
Dec 12, 2024, 8:48:31 AM12/12/24
to R-inla discussion group
Say I have Gaussian data where the independent noise parameter differs by (assumed known) groups but with the same latent field. My data is spatial but to illustrate it visually see the first plot in 1D. 
ie assume we have 
Y_g1 ~ U + N(0,(sigma_g1)^2)
Y_g2 ~ U + N(0,(sigma_g2)^2)
INLADiscussionSample.png

eg in this example sigma_g1 = 0.05 and sigma_g2 = 0.3

In essence I have a spatial process that may be measured in two ways, each with an associated error. (Or potentially up to say 3/4 groups). Can such a model be fit with inla , assume the general structure of my code is as follows (Taken from a worked example in E. T. Krainski et al. (2019)).  

spde <- inla.spde2.pcmatern( ... ) # mesh/priors for range/ std dev

formula <- response ~ -1 + beta0 + f(i, model = spde) # may also include covaraites

data_stack<- inla.stack(
  data = list(response =  df$response),
  A = list(A5, 1),
  effects = list(i = 1:spde$n.spde,
    beta0 = rep(1, nrow(df))),
  tag = 'est')

res5 <- inla(formula,
  data = inla.stack.data(data_stack),
  control.predictor = list(A = inla.stack.A( data_stack  )))

and assume some df contains the data:  X ,Y , Group , response.

Additionally if the above is possible, can I then assume priors could be placed on them (ie if prior knowledge is that g1 should have high precision and g2 should have low precision)

Finn Lindgren

unread,
Dec 12, 2024, 12:24:48 PM12/12/24
to Eamonn o, R-inla discussion group
Hi,
One option is to include a separate random effect for each group to account for this. If your observation model i Gaussin (like your toy example) that would however make those variances mutually nonidentifiable with the inla observation model variance. To handle that, you could set the observation model precision to a fixed, large value, in effect trading the observations as near-exact, given the random effects.

But I think there may also be a special model that allows a few fixed effects in the precision model; some binary indicators would then handle it. 

Finn

--
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, visit https://groups.google.com/d/msgid/r-inla-discussion-group/95997f91-1d4f-4500-886f-a9edeea5b99fn%40googlegroups.com.

Håvard Rue

unread,
Dec 13, 2024, 2:02:15 AM12/13/24
to Eamonn o, R-inla discussion group
when both variances are unknown, but you know the group, you need to code this
as having two likelihood, one for the first group and one for the second group




On Thu, 2024-12-12 at 05:27 -0800, Eamonn o wrote:
> Say I have Gaussian data where the independent noise parameter differs by
> (assumed known) groups but with the same latent field. My data is spatial but
> to illustrate it visually see the first plot in 1D. 
> ie assume we have 
> Y_g1 ~ U + N(0,(sigma_g1)^2)
> Y_g2 ~ U + N(0,(sigma_g2)^2)
> INLADiscussionSample.png
>
> eg in this example sigma_g1 = 0.05 and sigma_g2 = 0.3
>
> In essence I have a spatial process that may be measured in two ways, each
> with an associated error. (Or potentially up to say 3/4 groups). Can such a
> model be fit with inla , assume the general structure of my code is as follows
> (Taken from a worked example in E. T. Krainski et al. (2019)).  
>
> spde <- inla.spde2.pcmatern( ... ) # mesh/priors for range/ std dev
>
> formula <- response ~ -1 + beta0 + f(i, model = spde) # may also include
> covaraites
>
> data_stack<- inla.stack(
>   data = list(response =  df$response),
>   A = list(A5, 1),
>   effects = list(i = 1:spde$n.spde,
>     beta0 = rep(1, nrow(df))),
>   tag = 'est')
>
> res5 <- inla(formula,
>   data = inla.stack.data(data_stack),
>   control.predictor = list(A = inla.stack.A( data_stack  )))
>
> and assume some df contains the data:  X ,Y , Group , response.
>
> Additionally if the above is possible, can I then assume priors could be
> placed on them (ie if prior knowledge is that g1 should have high precision
> and g2 should have low precision)
>
> --
> 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, visit
> https://groups.google.com/d/msgid/r-inla-discussion-group/95997f91-1d4f-4500-886f-a9edeea5b99fn%40googlegroups.com
> .

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

Reply all
Reply to author
Forward
0 new messages