gibbs               package:LearnBayes               R Documentation

_M_e_t_r_o_p_o_l_i_s _w_i_t_h_i_n _G_i_b_b_s _s_a_m_p_l_i_n_g _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:

     Implements a Metropolis-within-Gibbs sampling algorithm for an
     arbitrary real-valued posterior density defined by the user

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

     gibbs(logpost,start,m,scale,data)

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

 logpost: function defining the log posterior density

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

       m: the number of iterations of the chain

   scale: vector of scale parameters for the random walk Metropolis
          steps

    data: 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: vector of acceptance rates of the Metropolis steps 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)
     start=array(c(1,1),c(1,2))
     m=1000
     scale=c(2,2)
     s=gibbs(logctablepost,start,m,scale,data)

