Generate standard normal rv’s using the slice sampler.
Generate rv’s from a density \(f(x,y)=xy+1,0<x,y<1\) using the slice sampler.
Below is a sample from a geometric random variable with rate r, that is \(P(X=k)=r(1-r)^{k-1};k=1,2,3,..\). Let’s say we know that \(0.2<r<0.4\), so we will do a Bayesian analysis using a prior \(\pi(r) = U[0.2, 0.4]\). Find a 90% credible interval for r using the quantiles of data simulated from the posterior distribution.
## x
## 1 2 3 4 5 7 9 11 12
## 14 8 8 5 6 6 1 1 1