Setting an informed prior on quadratic term?

13 views
Skip to first unread message

Rowenna Gryba

unread,
May 17, 2022, 7:26:05 PMMay 17
to R-inla discussion group
Hi,

I'm working on a model that includes a quadratic term for one of the covariates. For reasons I need to actually include the quadratic term rather than using splines. I'm having an issue assigning an informed prior to the quadratic term. 

formula <-STATUS ~  x1  + I(x1^2) + x2 + ....

model  <- inla(formula, family ="binomial", ....., control.fixed = list(
                                                             mean = list(x1 = mean.x1,
                                                                                     `x1^2` = mean.x1.2,
                                                                                     x2 = mean.x2),
                                                             prec = list(iceConc.z = prec.x1,
                                                                                     `x1^2` = prec.x1.2,
                                                                                     x2 = prec.x2) ))

For `x1^2` it is going to the default prior rather than my set values. 
I'm assuming it's something silly like how I'm calling the parameter in the control.fixed list? 

Any help would be appreciated!

Cheers,
Rowenna

Helpdesk

unread,
May 20, 2022, 9:35:47 AMMay 20
to Rowenna Gryba, R-inla discussion group
you can do

xx = x1^2

upfront and then add xx to the data.frame and the formula

otherwise, you can also use

f(xx,model="linear", mean.linear = <mu>, prec.linear = <prec>)

to define prior for this effect. see inla.doc("linear")

this was added to make the prior spesification easier

Cheers,
Rowenna
--
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/97333daa-c348-4ba6-91f7-fb879bb09c33n%40googlegroups.com.

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

Reply all
Reply to author
Forward
0 new messages