laplace {LearnBayes} | R Documentation |
Summarization of a posterior density by the Laplace method
Description
For a general posterior density, computes the posterior mode,
the associated variance-covariance matrix, and an estimate at the
logarithm at the normalizing constant.
Usage
laplace(logpost,mode,iter,par)
Arguments
logpost |
function that defines the logarithm of the posterior density |
mode |
vector that is a guess at the posterior mode |
iter |
number of iterations of Newton-Raphson algorithm |
par |
vector or list of parameters associated with the function logpost |
Value
mode |
current estimate at the posterior mode |
var |
current estimate at the associated variance-covariance matrix |
int |
estimate at the logarithm of the normalizing constant |
Author(s)
Jim Albert
Examples
logpost=function(theta,data)
{
s=5
val=0*theta
for (i in 1:length(data))
{
val=val-log(1+(data[i]-theta)^2/s^2)
}
return(val)
}
data=c(10,12,14,13,12,15)
laplace(logpost,10,5,data)
[Package
LearnBayes version 1.0
Index]