simulation fodder for future exams
Here are two nice exercises for a future simulation exam, seen and solved on X validated.The first one is about simulating a Gibbs sampler associated with the joint target
exp{-|x|-|y|-a|y-x|}
defined over IR² for a≥0 (or possibly a>-1). The conditionals are identical and non-standard, but a simple bound on the conditional density is the corresponding standard double exponential density, which makes for a straightforward accept-reject implementation. However it is also feasible to break the full conditional into three parts, depending on the respective positions of x, y, and 0, and to obtain easily invertible cdfs on the three intervals.The second exercise is about simulating from the cdf
which can be numerically inverted. It is however more fun to call for an accept-reject algorithm by bounding the density with a ½ ½ mixture of an Exponential Exp(a) and of the 1/(p+1)-th power of an Exponential Exp(b/(p+1)). Since no extra constant appears in the solution, I suspect the (p+1) in b/(p+1) was introduced on purpose. As seen in the above fit for 10⁶ simulations (and a=1,b=2,p=3), there is no deviation from the target! There is nonetheless an even simpler and rather elegant resolution to the exercise: since the tail function (1-F(x)) appears as the product of two tail functions, exp(-ax) and the other one, the cdf is the distribution of the minimum of two random variates, one with the Exp(a) distribution and the other one being the 1/(p+1)-th power of an Exponential Exp(b/(p+1)) distribution. Which of course returns a very similar histogram fit:
February 21, 2019 at 11:35 am
So you now announce your future exam questions on your blog?
February 21, 2019 at 8:11 pm
It helps with grading, doesn’t it?!
February 20, 2019 at 6:36 am
[…] leave a comment for the author, please follow the link and comment on their blog: R – Xi’an’s Og. R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data […]
February 20, 2019 at 12:26 am
I think the equation you have in mind is exp{-|x|-|y|-a|y-x|}
February 20, 2019 at 9:56 am
Thanks you, Bill, add my eyesight, small fonts, black background and I cannot distinguish | from ) and even more frequently , from .
February 20, 2019 at 7:31 pm
Yes, that’s a problem. Bothers me too. So why do you use a black background and small font?
February 20, 2019 at 8:25 pm
Esthetics over practical, I fear, which is not the best justification, I re-fear…!