powered by
Implements a rejection sampling algorithm for a probability density using a multivariate t proposal density
rejectsampling(logf,tpar,dmax,n,data)
matrix of simulated draws from density of interest
function that defines the logarithm of the density of interest
list of parameters of t proposal density including the mean m, scale matrix var, and degrees of freedom df
logarithm of the rejection sampling constant
number of simulated draws from proposal density
data and or parameters used in the function logf
Jim Albert
data(cancermortality) start=c(-7,6) fit=laplace(betabinexch,start,cancermortality) tpar=list(m=fit$mode,var=2*fit$var,df=4) theta=rejectsampling(betabinexch,tpar,-569.2813,1000,cancermortality)
Run the code above in your browser using DataLab