powered by
Simulates iterates of a random walk Metropolis chain for an arbitrary real-valued posterior density defined by the user
rwmetrop(logpost,proposal,start,m,...)
function defining the log posterior density
a list containing var, an estimated variance-covariance matrix, and scale, the Metropolis scale factor
vector containing the starting value of the parameter
the number of iterations of the chain
data that is used in the function logpost
a matrix of simulated values where each row corresponds to a value of the vector parameter
the acceptance rate of the algorithm
# NOT RUN { data=c(6,2,3,10) varcov=diag(c(1,1)) proposal=list(var=varcov,scale=2) start=array(c(1,1),c(1,2)) m=1000 s=rwmetrop(logctablepost,proposal,start,m,data) # }
Run the code above in your browser using DataLab