# [R] MCMC sampling question

Duncan Murdoch murdoch at stats.uwo.ca
Wed Aug 12 10:50:48 CEST 2009

```Thomas Mang wrote:
> Hello,
>
>
> Consider MCMC sampling with metropolis / metropolis hastings proposals
> and a density function with a given valid parameter space. How are MCMC
> proposals performed if the parameter could be located at the very
> extreme of the parameter space, or even 'beyond that' ?

Just like others.  The density at the edge of the space determines
whether you'll accept a move there, the density outside the space is
zero, so you won't.
>  Example to
> express it and my very nontechnical 'beyond that': The von Mises
> distribution is a circular distribution, describing directional trends.
> It has a concentration parameter Kappa, with Kappa > 0. The lower kappa,
> the flatter the distribution, and for Kappa approaching 0, it converges
> into the uniform. Kappa shall be estimated [in a complex likelihood]
> through MCMC, with the problem that it is possible that there truly
> isn't any directional trend in the data at all, that is Kappa -> 0; the
> latter would even constitute the H0.
> If I log-transform Kappa to get in on the real line, will the chain then
> ever fulfill convergence criteria ?

Sure, but remember to transform the density in a corresponding way.
> The values for logged Kappa should
> be on average I suppose less and less all the time. But suppose it finds
> an almost flat plateau. How do I then test against the H0 - by
> definition, I'll never get a Kappa = 0 exactly; so I can't compare
> against that.
>

What does MCMC have to do with hypothesis testing?  Standard hypothesis
testing has to do with the distribution of the data, not the likelihood
or posterior distribution of some parameter.
> One idea I had: Define not only a parameter Kappa, but also one of an
> indicator function, which acts as switch between a uniform and a
> vonMises distribution. Call that parameter d. I could then for example
> let d switch state with a 50% probability and then make usual acceptance
> tests.
> Is this approach realistic ? is it sound and solid or nonsense /
> suboptimal? Is there a common solution to the before mentioned problem ?
> [I suppose there is. Mixed effects models testing the variances of
> random effects for 0 should fall into the same kind of problem].
>
>
What you're describing is an approach to Bayesian hypothesis testing.
I've never been convinced that Bayesian hypothesis testing is a good
approach, but some people use it.

Another way to formulate this approach is to use a prior with a point
mass at kappa = 0.  You need to use a non-standard density to do
Metropolis-Hastings (I think Metropolis won't work), but MCMC is
possible.  (The density needs to be evaluated as a discrete measure at 0
and a continuous measure everywhere else.)

Duncan Murdoch
> cheers,
> Thomas
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

```