rwmetrop             package:LearnBayes             R Documentation

_R_a_n_d_o_m _w_a_l_k _M_e_t_r_o_p_o_l_i_s _a_l_g_o_r_i_t_h_m _o_f _a _p_o_s_t_e_r_i_o_r _d_i_s_t_r_i_b_u_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Simulates iterates of a random walk Metropolis chain for an
     arbitrary  real-valued posterior density defined by the user

_U_s_a_g_e:

     rwmetrop(logpost,proposal,start,m,par)

_A_r_g_u_m_e_n_t_s:

 logpost: function defining the log posterior density

proposal: a list containing var, an estimated variance-covariance
          matrix, and scale, the Metropolis scale factor

   start: array with a single row that gives the starting value of the
          parameter vector

       m: the number of iterations of the chain

     par: data that is used in the function logpost

_V_a_l_u_e:

     par: a matrix of simulated values where each row corresponds to a
          value of the vector parameter

  accept: the acceptance rate of the algorithm

_A_u_t_h_o_r(_s):

     Jim Albert

_E_x_a_m_p_l_e_s:

     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)

