LearnBayes (version 2.15.1)

rejectsampling: Rejecting sampling using a t proposal density

Description

Implements a rejection sampling algorithm for a probability density using a multivariate t proposal density

Usage

rejectsampling(logf,tpar,dmax,n,data)

Arguments

logf

function that defines the logarithm of the density of interest

tpar

list of parameters of t proposal density including the mean m, scale matrix var, and degrees of freedom df

dmax

logarithm of the rejection sampling constant

n

number of simulated draws from proposal density

data

data and or parameters used in the function logf

Value

matrix of simulated draws from density of interest

Examples

Run this code
# NOT RUN {
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 DataCamp Workspace