# Problem Sampling with Metropolis Hastings

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.

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

## 1 Answer

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.,