On Fri, 2018-08-10 at 00:39 -0700,
s.p....@gmail.com wrote:
> I have a question about the correct interpretation of the estimates
> provided by R-INLA when running a LogNormal regression. This is
> probably trivial for everyone on this forum but I am looking for the
> exact proper wording to go with it and how it would differ from
> running a normal regression of log-transform response.
>
> Here is a slight extension of example code form this website, with an
> additional fixed effect:
>
> require(INLA)
> n = 300
> x1 = c(scale(runif(n)))
> x2 = c(scale(runif(n)))
> eta = 1+2.2*x1+3.1*x2
> y = exp(rnorm(n, mean = eta, sd = 1))
> data = data.frame(y, x1, x2)
> formula=y ~1+x1+x2
> r=inla(formula, family ="lognormal", data=data)
> summary(r)
>
> When you run this you get three posterior average estimates
> (intercept and the estimates for the effects of x1 and x2):
>
> > r$summary.fixed$mean
> [1] 0.9443243 2.1517555 3.0380717
this seems correct.
> I was looking at the pdf of the lognormal and saw eta = mu, so maybe
> i am going at this completely the wrong way....
>
> Anyway, for the intercept, I would instinctively do the same as if I
> had log-transformed the response and go with:
this should be the same as above (up to the default prior for the log
precision, which I havn't checked).
data = data.frame(y, x1, x2)
formula=log(y) ~1+x1+x2
r=inla(formula, family ="normal", data=data)
summary(r)
> > exp(r$summary.fixed$mean[1])
> [1] 2.571076
> "The overall average of y is 2.57 for x1 = x2 = 0" (wording it better
> for x1 = x2 = 0 according to what those variable are)
its not strictly true, as the mean of y depends on also on the
variance. you can say that for log(y) the overall effect is 0.9443243
as you see above, using
y ~ ....
and lognormal, is eqv with
log(y) ~ ...
and normal.
it is not more difficult that this.
Best
H
> But for the two fixed effects, I am hesitant with just taking the
> exponential of the output since the effect is additive on the log
> scale...
>
> I started with
>
> > exp(r$summary.fixed$mean[2:3])
> [1] 8.599943 20.864971
> "For each one unit increase in x1, y would increase on average by
> 8.60 , with the effect of x1 remaining constant"
> (same kind of thing for x2)
>
> but then it was not sitting quite right. So I was thinking maybe
>
> > (exp(r$summary.fixed$mean[2:3])-1)*100
> [1] 759.9943 1986.4971
> "For each one unit increase in x1, the average y increases
> by 759.99%, with the effect of x1 remaining constant"
> (same kind of thing for x2)
>
> I am probably overthinking this. Again my apologies, but after
> spending 4.5 hours in books and on google, I could not find a final
> straight answer.
>
> Thank you very much for your help.
>
> Sab.
>
>
>
> --
> 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.
> For more options, visit
https://groups.google.com/d/optout.
--
Håvard Rue
Helpdesk
he...@r-inla.org