Variance modeling

30 views
Skip to first unread message

Lorenzo Valleggi

unread,
Mar 17, 2023, 6:24:41 AM3/17/23
to R-inla discussion group
Dear all, 
im trying to model variance as follow:

\sigma^2_{i,j}(X) = abs(X)^{2\theta_j}}
where i are the observations and j are groups where residuals change in terms of variance,
X are covariates, and theta is a variance coefficient. This specification is implemented in the nlme package. 

 Does someone know how to implement this specification in RINLA?


Finn Lindgren

unread,
Mar 17, 2023, 7:13:41 AM3/17/23
to Lorenzo Valleggi, R-inla discussion group
Hi Lorenzo,

This depends on what part of the model needs those variances. For the observation model, i believe there is a model that allows a simple log-linear model for the precision. You can reviret your model as exp(theta_j log(abs(x)), so that might work.

For latent components, I don't think this is implemented, but one option is to use the inlabru package interface, where you can implement this via an R expression and a transformed Gaussian:

comp <- ~ 0 + log_theta(groupid, model=“iid”, hyper=list(prec=list(initial=log(log_theta_prec), fixed=TRUE))) + eff(idx, model = "iid", hyper=list(prec=list(initial=0, fixed = TRUE)))
formula <- response ~ abs(x)^exp(log_theta) * eff

where log_theta_prec is the precision parameter for a lognormal prior for the theta parameters.

inlabru iteratively linearizes and runs inla on the linearised model.

Finn

On 17 Mar 2023, at 11:24, Lorenzo Valleggi <lorenzo....@unifi.it> wrote:

Dear all, 
--
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/4485edbe-c31e-4c37-86dc-88d973deea7fn%40googlegroups.com.

Helpdesk (Haavard Rue)

unread,
Mar 17, 2023, 3:47:59 PM3/17/23
to Lorenzo Valleggi, R-inla discussion group
This form is not implemented. There are plans for adding that
log(variance) can depend on covariates, but this form is different...
what other forms similar to this is in the nlme package?
> --
> 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/4485edbe-c31e-4c37-86dc-88d973deea7fn%40googlegroups.com
> .

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

Virgilio Gómez-Rubio

unread,
Mar 20, 2023, 5:46:53 AM3/20/23
to Lorenzo Valleggi, R-inla discussion group
Hi,

\sigma^2_{i,j}(X) = abs(X)^{2\theta_j}}
where i are the observations and j are groups where residuals change in terms of variance,
X are covariates, and theta is a variance coefficient. This specification is implemented in the nlme package. 

 Does someone know how to implement this specification in RINLA?

We have done something along this by combining INLA and importance sampling. You can check these two papers:



Each paper has its own repository in GitHub with examples and R code. 

The good thing of using IS is that you can (almost) reach INLA speed if you have a computer with a good number of cores.

You will be able to model log(precision) on a linear predictor that may include any fixed and random effects implemented in INLA.

Best,

Virgilio




Reply all
Reply to author
Forward
0 new messages