Reconstructing confidence intervals for interaction terms

Skip to first unread message

Colin Beale

unread,
Nov 27, 2015, 9:43:13 AM11/27/15
to R-inla discussion group

This is, I hope, a very quick question – certainly a basic one! I've been building some models using inla that have an interaction term included between two variables. This is often very important in my data. I get a nice summary of my model using summary(mod1) that includes the confidence intervals. In the data I have, when the value of the interacting factor is false there is often an obviously significant positive effect of by dependent variable, but the raw data suggest that the slope for data when the factor is TRUE is pretty close to zero. This is exactly what we predicted, so I'm quite excited, but I'm trying to work out the correct way to recover credible intervals for the slopes in both cases.

EG summary results:

variable                   mean    sd   0.025     0.5   0.0975   kld

(Intercept):                   2.3   0.3     0.1      2.2       4.1     0

rain:                            10.1  2.3      6.3    10.1    17.5     0

FactorTRUE:               0.2  0.01   0.05     0.21    0.32    0

rain:FactorTRUE:     -10.3    3.2   -5.3   -10.2    -19.4    0

Since FALSE is the reference level, I think the slope and its intervals are simply described by the output table. (e.g. median = 10.1 low = 6.3, upper = 17.5)

I also think the median value for the slope in the TRUE case is close enough to the sum of the median for the reference level and the interaction term (-0.1: essentially zero). But the credible intervals for the interaction are not the sum of the lower and upper intervals (i.e. not 6.3-5.3 and 17.5-19.4), since the chance of getting the lowest likely parameter value for both factor levels in the same model are obviously much lower than they should be (0.025^2). I'm sure calculating this joint interval so I can correctly extract the credible intervals (for plotting or whatever – in this case showing that is correctly overlaps zero) is easy – but not from the summary table and I can't work out how to correctly calculate this from the inla object.


Any pointers welcome!


Thanks!



Elias T Krainski

unread,
Nov 27, 2015, 9:50:32 AM11/27/15
to r-inla-disc...@googlegroups.com
Hi,

You can ask INLA to compute posterior marginals for contrasts by
defining a linear combination using the feature described in item 17 at
http://www.r-inla.org/faq

Elias

Colin Beale

unread,
Nov 28, 2015, 3:38:48 AM11/28/15
to R-inla discussion group
That is exactly the one - thanks! Searching on the wrong terms...

C
Reply all
Reply to author
Forward
0 new messages