hyperdirichlet        package:hyperdirichlet        R Documentation

_T_h_e _H_y_p_e_r_d_i_r_i_c_h_l_e_t _d_i_s_t_r_i_b_u_t_i_o_n

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

     Create, coerce to, or test for an object of class 'hyperdirichlet'

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

     hyperdirichlet(x, NC, pnames = character(), validated=FALSE)
     is.hyperdirichlet(x)
     as.hyperdirichlet(x, calculate_NC = FALSE , ...)

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

       x: Object to be coerced or tested for

      NC: Normalizing constant

  pnames: names of the columns with length-0 default  resulting in the
          print method using column names 'p1', 'p2', etc

validated: Boolean.  Setting to 'TRUE' is taken to mean that 'x' is
          *known* to be proper (_i.e._ 'x' is normalizable), but the
          normalizing constant is not necessarily known.

          Default 'FALSE' is taken to mean that 'x' is not known to be
          proper: it is possible that 'x' is not normalizable so cannot
          correspond to a PDF.

          Setting to 'FALSE' means that the object will be passed to
          'is.proper()' for checking; this can be time-consuming.  The
          flag is set to 'TRUE' _ab initio_ for 'dirichlet()' and
          'gd()' because these distributions have an analytical
          expression for the normalizing constant

calculate_NC: Boolean, with default 'FALSE' meaning not to calculate
          the normalizing constant and 'TRUE' meaning to calculate it

     ...: Further arguments passed to 'adapt()'

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

     To determine the normalization constant, use something like 'a <-
     as.hyperdirichlet(a,calculate_NC= TRUE)'.

     Matrices may be coerced to a hyperdichlet object using
     'as.hyperdirichlet()': the call is dispatched to 'matrix_to_HD()'
     (qv).

     If 'x' is a matrix, be sure to specify the 'bernoulli' argument,
     which is passed on to 'matrix_to_HD()'

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

     Functions 'hyperdirichlet()' and 'as.hyperdirichlet()' return a
     hyperdirichlet object; function 'is.hyperdirichlet()' returns a
     Boolean.

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

     Robin K. S. Hankin

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

     'B','extract','matrix_to_HD'

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

     (a <- uniform(3))
     a[c(TRUE,TRUE,FALSE)] <- 0.3
     ## Not run: 
     (a <- as.hyperdirichlet(a, calculate_NC = TRUE))  # recommended way to calculate NC
     ## End(Not run)

     (b <- dirichlet(1:3))
     as.hyperdirichlet(b)          # "forgets" the normalizing constant

     ## Not run: 
     as.hyperdirichlet(b, TRUE)    # recalculates NC; accuracy tolerable
                                   # (analytic answer = 1/60)
     ## End(Not run)

     ## Not run: 
       # takes a long time
     op <- options()
     options(warn = -1)
     x <- dirichlet(rep(2,4)) + justpairs(matrix(1,4,4))
     f <- function(p){p[1]>p[2]}
     probability(x,f) # should be 0.5: distribution is symmetric
     ## End(Not run)

