offset.linear.predictor

75 views
Skip to first unread message

shicx

unread,
Nov 4, 2023, 12:14:51 PM11/4/23
to R-inla discussion group
Hello!
After fitted a poisson model, what is the difference between offset.linear.predictor and summary.linear.predictor in result.
Thanks.

Helpdesk (Haavard Rue)

unread,
Nov 4, 2023, 1:41:39 PM11/4/23
to shicx, R-inla discussion group
> r=inla(y ~ 1, data=data.frame(y=1))
> r$summary.linear.predictor[1,"mean"]
[1] 0.9999969735
> r$offset.linear.predictor[1]
[1] 0
> r=inla(y ~ 1, data=data.frame(y=1), offset=2)
> r$summary.linear.predictor[1,"mean"]
[1] 0.9999969735
> r$offset.linear.predictor[1]
[1] 2
> r=inla(y ~ 1 + offset(-2), data=data.frame(y=1), offset=2)
> r$summary.linear.predictor[1,"mean"]
[1] 0.9999969735
> r$offset.linear.predictor[1]
[1] 0
> --
> 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/6bd8233d-2144-448c-b209-09884a5616bfn%40googlegroups.com
> .

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

shicx

unread,
Nov 4, 2023, 11:59:39 PM11/4/23
to R-inla discussion group
Thank you for your reply, for the following example, I would like to ask if it is possible to go to calculate the intercept.linear.predictor. e.g. r$summary.linear.predictor[1, "mean"]-r$offset.linear.predictor[1]?

> r=inla(y ~ 1, data=data.frame(y=1), offset=2)
> r$summary.linear.predictor[1, "mean"]
[1] 0.9999969735
> r$offset.linear.predictor[1]
[1] 2


Helpdesk (Haavard Rue)

unread,
Nov 5, 2023, 1:22:08 AM11/5/23
to shicx, R-inla discussion group
I do not understand what you mean. the offset goes into the linear
predictor and the offset.linear.predictor is there to keep track of the
offset variable, as it can come in from several sources.

you can also get the intercept itself, using r$summary.fixed

shicx

unread,
Nov 5, 2023, 1:54:40 AM11/5/23
to R-inla discussion group
If there are covariates x in the equation, I want to get eta with only intercept and covariates, i.e., liear.predictor with offset removed. because i guess this can be used in a with-offset poisson model to predict the incidence of points with no offset value.

> r=inla(y ~ 1+x, data=data.frame(y=1,x=2), offset=2) > r$summary.linear.predictor[1, "mean"] [1] 0.9999999 > r$offset.linear.predictor[1] [1] 2

Helpdesk (Haavard Rue)

unread,
Nov 5, 2023, 2:29:04 AM11/5/23
to shicx, R-inla discussion group
you just subtract the offset then, right?

shicx

unread,
Nov 5, 2023, 2:59:20 AM11/5/23
to R-inla discussion group
yes.
Thank you!

Reply all
Reply to author
Forward
0 new messages