I'm trying to use the Metropolis-Hastings (MH) algorithm to obtain an approximation of the distribution of the parameters of the following model:

$$ y_{t} = \alpha x_{t}^\beta + w_{t} $$ $$ w_{t} \ \text{~} \ \mathcal{N}(0,\sigma^2) $$

I'm using a random-walk version of MH where my jumping distribution also contains a normal distribution (multivariate in this case):

$$ \theta_{t} = \theta_{t-1} + \textbf{e} $$ $$ \textbf{e} \ \text{~} \ \mathcal{N}(\textbf{0},c^2\textbf{I}) $$

with $c$ just being a scaling parameter.

How can I account for the fact that $\alpha$ and $\beta$ can be any real number but $\sigma^2$ has to be nonnegative?

A cheap fix could be to force the algorithm to reject negative values for the variance by assigning arbitrarily low probability to any sampled vector containing negative variance values.

Any reference or ideas would be greatly appreciated.

  • 1
    $\begingroup$ You say that the target distribution is normal, but one of the components is a variance parameter. How is the target distribution normal then? $\endgroup$ May 3, 2017 at 15:16
  • $\begingroup$ What I'm trying to say is that $P(\theta) = $ likelihood with normal density $\endgroup$
    – Slakeon
    May 3, 2017 at 16:05
  • 1
    $\begingroup$ But $\theta = (\mu, \sigma^2)$, so how can that be normally distributed? $\endgroup$ May 3, 2017 at 16:10
  • $\begingroup$ Yes, you are right! I edited the question to include the specifics. That is the problem that I need to solve. $\endgroup$
    – Slakeon
    May 3, 2017 at 16:43

1 Answer 1


I think this question has been addressed many times on Cross Validated: proposing a negative value when the target distribution is of no consequence since the target density is equal to zero at this negative value. A Metropolis-Hasting algorithm that is described in the question as a random-walk version of MH thus works in such a context: for each proposal with a negative variance, the chain repeats its current value.

See, e.g.,


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.