0
$\begingroup$

I am trying to do a Bayesian linear regression. Since my data cannot be negative a gave them a log-Normal distribution, but I am not sure if the priors should be positive also. If I write my model using log-Normal priors for the intercept and the slope I get quite good adjustment. Instead, if I use Normal priors I don't and the priors do not separate from the posterior distributions. But I am not sure if this is statistically correct. Here is the model:

#linear regression
o<-c(22.77619, 19.07782, 22.08817, 16.32168, 32.57081,NA, 10.48027, 15.93440, 27.54557, 33.39933)
evi<-c(0.07289889,0.06288981,0.065947587,0.05886781,
0.07037986,0.07256388,0.06540081,0.07219641,0.0798039,0.08368564)

n<-9
#problema -> distribución de poisson

cat(file = "reg.bug", "
  #Likelihood:
    model {
    for(i in 1:9){
    o[i] ~ dlnorm(mu[i],tau) 
   mu[i] <- b0 + b1 *log(evi[i]) 
    }
#priors:
    b0 ~ dlnorm(1,0.001)
    b1 ~ dlnorm(1,0.001)
    tau ~ dgamma(1,5)

    }")


#linear regression
reg.data<-c("o","evi")

inits<-function()list(b0=rlnorm(1,1,1),b1=runif(0,1),tau=runif(0.1,1))

params<-c("b0","b1","tau")

ni <- 100000
nt <- 1
nb <- 50000
nc <- 3

library(jagsUI)

reg.model   <- jags (model.file = "reg.bug", data = reg.data, parameters.to.save = params,
                   inits=inits,n.burnin=nb,n.chains = nc,n.iter = ni)
reg.model
$\endgroup$
  • 1
    $\begingroup$ You can model the priors on the unbounded scale by applying a link function to the linear predictor. $\endgroup$ – Demetri Pananos Jan 4 at 20:33
  • 1
    $\begingroup$ Also, can you show us your model? $\endgroup$ – Demetri Pananos Jan 4 at 20:50
  • $\begingroup$ @DemetriPananos I have edited the question to show the model, any comments are welcome. Thank you! $\endgroup$ – Antonela Jan 4 at 21:18
1
$\begingroup$

TL;DR no, doing this by choosing log-normal priors is not the best idea.

  • If your data is non-negative, you cannot use linear regression, since linear regression is a model for unbounded values.
  • Choosing priors that are non-negative does not have to make the outcome of the model non-negative. For example, if one of the variables takes only negative values, then with positive-valued parameter, multiplying one by another would lead to negative output. In such case you would actually need a prior that takes only negative values. As you can see, this is not that simple. In general, priors are about the assumed distribution of the parameters, not the outcome.
  • "Hacking" priors, so that they lead of some pre-defined outcome is not the best idea. If you feel that you are forced to do it, because otherwise your model doesn't work, then you should consider if you have enough data, if there is no problems with the data, or if the model definition is reasonable, as it could suggest some problems with either of those.
  • If you are using log-normal distribution as a likelihood function, then this is not a linear regression any more, it is a generalized linear model.
  • With your regression model, you are predicting mean $\mu$ of the log-normal distribution. Mean of the log-normal distribution does not have to be non-negative, it can take any values on the real line. What follows, there is no need for you to restrict the outcomes of the linear predictor function (the $\mathbf{X}\boldsymbol{\beta}$ part of the model) anyhow to get valid result.
  • If you've chosen some other distribution for the likelihood function that needed the mean to be bounded to non-negative values, the usual approach would be to use a link function that would transform the outcome of the linear predictor to non-negative values. One popular example would be to use the $\exp$ function, as in Poisson regression. In such case, again, you don't need to restrict the parameters.
| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you for your answer. The values of the two variables that I intend to relate cannot be negative. As a consequence, log-norm distribution is not a good choice. I should choose a distribution bounded to positive values in the real line. Is this correct? $\endgroup$ – Antonela Jan 6 at 17:00
  • $\begingroup$ @Antonela I never said that log-normal is a bad choice. If your predicted variable is non-negative, then log-normal may be reasonable for likelihood. As about prior, it depends on what you assume about the parameters, but non-negative predicted variable does not need the parameters to be non-negative, as said in the answer. $\endgroup$ – Tim Jan 6 at 17:14
  • $\begingroup$ Thank you for your answer. $\endgroup$ – Antonela Jan 6 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.