poisdp                package:Bolstad                R Documentation

_P_o_i_s_s_o_n _s_a_m_p_l_i_n_g _w_i_t_h _a _d_i_s_c_r_e_t_e _p_r_i_o_r

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

     Evaluates and plots the posterior density for mu, the mean rate of
     occurance in a Poisson process and a discrete prior on mu

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

     poisdp(y.obs, mu, mu.prior, ret = FALSE)

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

   y.obs: a random sample from a Poisson distribution.

      mu: a vector of possibilities for the mean rate of occurance of
          an event over a finite period of space or time.

mu.prior: the associated prior probability mass.

     ret: if true then the likelihood and posterior are returned as a
          list.

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

     If ret is true, then a list will be returned with the following
     components:

likelihood: the scaled likelihood function for mu given y.obs

posterior: the posterior probability of mu given y.obs

      mu: the vector of possible mu values used in the prior

mu.prior: the associated probability mass for the values in mu

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

     'poisgamp' 'poisgcp'

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

     ## simplest call with an observation of 4 and a uniform prior on the
     ## values mu = 1,2,3
     poisdp(4,1:3,c(1,1,1)/3)

     ##  Same as the previous example but a non-uniform discrete prior
     mu<-1:3
     mu.prior<-c(0.3,0.4,0.3)
     poisdp(4,mu=mu,mu.prior=mu.prior)

     ##  Same as the previous example but a non-uniform discrete prior
     mu<-seq(0.5,9.5,by=0.05)
     mu.prior<-runif(length(mu))
     mu.prior<-sort(mu.prior/sum(mu.prior))
     poisdp(4,mu=mu,mu.prior=mu.prior)

     ## A random sample of 50 observations from a Poisson distribution with
     ## parameter mu = 3 and  non-uniform prior
     y.obs<-rpois(50,3)
     mu<-c(1:5)
     mu.prior<-c(0.1,0.1,0.05,0.25,0.5)
     results<-poisdp(y.obs, mu, mu.prior, ret=TRUE)

     ##  Same as the previous example but a non-uniform discrete prior
     mu<-seq(0.5,5.5,by=0.05)
     mu.prior<-runif(length(mu))
     mu.prior<-sort(mu.prior/sum(mu.prior))
     y.obs<-rpois(50,3)
     poisdp(y.obs,mu=mu,mu.prior=mu.prior)

