Weights in INLA as in GLM

1,283 views
Skip to first unread message

Maëlle Salmon

unread,
Jun 5, 2014, 8:38:36 AM6/5/14
to r-inla-disc...@googlegroups.com
Dear Help,

I have a question about weights in INLA, to which I could not find an answer in the threads although the subject was already discussed.

I am a beginner user of INLA and trying to implement a Bayesian version of a model I have already implemented in R with the function glm(). In this first implementation I used the glm option "weights" that are prior weights used in the fitting. http://stat.ethz.ch/R-manual/R-patched/library/stats/html/glm.html

My data are time series of counts and I fit a model to them to make predictions about the current count.

This is want I want to do:
- I first fit a model to the time series.
- For each data point I calculate a residual. In my first implementation I calculated Anscombe residuals but I may choose something else. My goal is to spot "outliers", that is to say counts that very likely are too high/not normal and will make the prediction for the current count too high. Based on the residuals I calculate a weight for each observed count that should allow me to down-weight the aberrant counts. This way I shall be able to get a prediction that is not spoiled by aberrant past counts.
- Then I fit the model again with weights.

I wonder if there is a way to do this in INLA?

Thanks a lot for your help!

Best regards,

Maëlle.

INLA help

unread,
Jun 5, 2014, 3:30:54 PM6/5/14
to Maëlle Salmon, r-inla-disc...@googlegroups.com
Hi,

The option 'weight' in the inla-call, put weights to the
log-likelihood, and is rarely used and its use is disabled by default.
So I guess what you want to do, will not involve the 'weights'.

residuals: as INLA uses a Bayesian approach, there is no such thing as
'a residual'. Maybe you would like to use cross-validation and PIT, like

prob(y_new <= y_obs | all other data)

for each data point??

Best
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
> http://groups.google.com/group/r-inla-discussion-group.
> For more options, visit https://groups.google.com/d/optout.


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

Hypatia Gwen

unread,
Oct 25, 2017, 5:30:20 PM10/25/17
to R-inla discussion group
I am trying to fit a spatial frailty model in a survey data. Without considering weight, the model looks like this:

formula_sex = inla.surv(age_child,status) ~ sex +
  f(District,model="besag",graph="my.graph", values = my.gen$NAME_2, adjust.for.con.comp=TRUE,scale.model = FALSE)

model_sex = inla(formula_sex,family="coxph", data=mydat,
           verbose=TRUE, control.hazard=list(model="rw1",n.intervals=20),
           keep=T) 

If I want my estimates to adjust for sample weight, which is a separate column assigned to each individual (within Districts), how can I do that?

Thanks in advance

Leo Bastos

unread,
Oct 26, 2017, 8:34:44 AM10/26/17
to R-inla discussion group
Hi,

The weights argument in INLA function is not for the sampling weights!
So you shouldn't use it. You may get the posterior point estimates
right, but the uncertainty would be wrong since usually the weights
are the inverse of a probability, hence big number. Your intervals
might then be too tiny.

As far as I know you may have to choose sampling weights (a) or
spatial frailties (b).

For (a) you should try the Thomas Lumley package survey, and take the
pseudo-likelihood approach (or should it be a
pseudo-Cox-partial-likehood? I don't know)

For (b) you should invoke the ignorability (in very simple terms: your
process doesn't depend on the sampling design) and go ahead as you
have a simple random sample, doing the INLA bit.

A third solution would be include variables related to your sample
design (strata, clusters,...) as random effects of your spatial
frailty model, so you somehow dealing with the design in your model.
> --
> 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.

Haakon Bakka

unread,
Oct 29, 2017, 3:37:59 AM10/29/17
to Leo Bastos, R-inla discussion group
I do not know the answer to your question.

But I can confirm that it is not the weights argument. That argument copies your data and uses it twice if weights = rep(2,N); and more times if the weight is higher, etc.



> To post to this group, send email to
--
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-group+unsub...@googlegroups.com.
To post to this group, send an email to r-inla-discussion-group@googlegroups.com.

David McAllister

unread,
Nov 16, 2017, 5:12:13 AM11/16/17
to R-inla discussion group
Hello,
The function svyglm in the survey package has an option to add inclusion probability weights. I wonder if that might help?
best wishes,
David MCAllister

Rifat Zahan

unread,
Jul 8, 2026, 1:49:42 PM (12 days ago) Jul 8
to R-inla discussion group
Seems like it's an old discussion. Did INLA do something in recent years to incorporate survey weights the same way we use multiple years survey weights in Bayesian hierarchical models? Usually, Demgraphic and Health survey suggest that if we are using multiple years' survey data to run any regression model, we need to adjust weights, if the sample sizes from each survey year differ. Any thoughts how we handle this in INLA?

Helpdesk (Haavard Rue)

unread,
Jul 9, 2026, 10:14:13 AM (12 days ago) Jul 9
to Rifat Zahan, R-inla discussion group

depends on what you mean by weights... i do not know exactly what you mean. INLA
has an option to scale log.likelihood contributions, if that could be helpful.
> --
> 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/6a4179c2-cb16-48e9-bb7a-b9c929bbd9adn%40googlegroups.com
> .

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

Rifat Zahan

unread,
Jul 9, 2026, 10:54:43 AM (11 days ago) Jul 9
to Helpdesk, R-inla discussion group
I am sorry that I wasn’t clear enough. I am talking about the survey weight. The one DHS has for clusters.

Sincerely,
Rifat

Prince Michael Amegbor

unread,
Jul 9, 2026, 11:03:28 AM (11 days ago) Jul 9
to riz...@gmail.com, Helpdesk, R-inla discussion group
Dear Rifat,

The survey weights you referenced are not for clusters. There are no survey weights for clusters in the DHS. There are weights for interviewed women, men and households. In some dhs modules there are weights for domestic violence. 

As noted in my message earlier see the recommendation by Chen et al., 2010





"Obosom a onnii guan da, ohu guan aniwam mpe a, ose, 'Eye srade' - A god that has never had a sheep given to it,  when it sees even the matter in the corner of a sheep's eye, says 'It is a fat one' "  - (Akan  Proverb)

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.
Reply all
Reply to author
Forward
0 new messages