MCmultinomdirichlet         package:MCMCpack         R Documentation

_M_o_n_t_e _C_a_r_l_o _S_i_m_u_l_a_t_i_o_n _f_r_o_m _a _M_u_l_t_i_n_o_m_i_a_l _L_i_k_e_l_i_h_o_o_d _w_i_t_h _a 
_D_i_r_i_c_h_l_e_t _P_r_i_o_r

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

     This function generates a sample from the posterior distribution
     of a multinomial likelihood with a Dirichlet prior.

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

     MCmultinomdirichlet(y, alpha0, mc=1000, ...)

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

       y: A vector of data (number of successes for each category).

  alpha0: The vector of parameters of the Dirichlet prior.

      mc: The number of Monte Carlo draws to make.

     ...: further arguments to be passed

_D_e_t_a_i_l_s:

     'MCmultinomdirichlet' directly simulates from the posterior
     distribution.  This model is designed primarily for instructional
     use.  pi is the parameter of interest of the multinomial
     distribution.  It is of dimension (d x 1). We assume a conjugate
     Dirichlet prior:

                        pi ~ Dirichlet(alpha0)

     y is a (d x 1) vector of observed data.

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

     An mcmc object that contains the posterior sample.  This  object
     can be summarized by functions provided by the coda package.

_S_e_e _A_l_s_o:

     'plot.mcmc', 'summary.mcmc'

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

     ## Not run: 
     ## Example from Gelman, et. al. (1995, p. 78)
     posterior <- MCmultinomdirichlet(c(727,583,137), c(1,1,1), mc=10000)
     bush.dukakis.diff <- posterior[,1] - posterior[,2]
     cat("Pr(Bush > Dukakis): ",
        sum(bush.dukakis.diff > 0) / length(bush.dukakis.diff), "\n")
     hist(bush.dukakis.diff)
     ## End(Not run)

