Description Usage Arguments Value Author(s) Examples
Implements importance sampling to compute the posterior mean of a function using a multivariate t proposal density
1 | impsampling(logf,tpar,h,n,data)
|
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 |
h |
function that defines h(theta) |
n |
number of simulated draws from proposal density |
data |
data and or parameters used in the function logf |
est |
estimate at the posterior mean |
se |
simulation standard error of estimate |
theta |
matrix of simulated draws from proposal density |
wt |
vector of importance sampling weights |
Jim Albert
1 2 3 4 5 6 | data(cancermortality)
start=c(-7,6)
fit=laplace(betabinexch,start,cancermortality)
tpar=list(m=fit$mode,var=2*fit$var,df=4)
myfunc=function(theta) return(theta[2])
theta=impsampling(betabinexch,tpar,myfunc,1000,cancermortality)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.