getOutcomeProb             package:dice             R Documentation

_C_a_l_c_u_l_a_t_e _t_h_e _P_r_o_b_a_b_i_l_i_t_y _o_f _a _S_p_e_c_i_f_i_e_d _S_e_t _o_f _O_u_t_c_o_m_e_s _o_f _a _D_i_c_e-_R_o_l_l

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

     For a specified dice-rolling process, 'getOutcomeProb' calculates
     the probability of an outcome (actually, in technical terms, an
     event consisting of a non-empty set of outcomes) that is specified
     by passing a 'list' object in to 'outcomeList'.

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

     getOutcomeProb(ndice, nsides, outcomeList, orderMatters = FALSE)

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

   ndice: A single positive integer representing the number of dice to
          roll 

  nsides: A single positive integer representing the number of sides on
          each die ('getOutcomeProb''s dice-rolling process involves
          only one type of die per call) 

outcomeList: A 'list' object, each element of which is a vector that
          constrains a single die in the dice-roll (see Details below)

orderMatters: A logical flag indicating whether the order of the
          elements of 'outcomeList' should constrain the outcome space;
          if TRUE, 'outcomeList' must specify constraints for every die
          roll-i.e., it must contain exactly 'ndice' elements (some of
          which may be "empty" constraints of the form '1:n', where 'n'
          is the same value passed in to 'nsides') 

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

     The crux of this function is 'outcomeList', which sets the
     conditions that acceptable dice-rolls must meet.  E.g., to get the
     probability of rolling at least one 6 when rolling four six-sided
     dice, 'outcomeList' would be 'list(6)' and 'orderMatters' would be
     FALSE; to get the probability of rolling a 6, followed by a 5,
     followed by either a 1, 2, or 3 when rolling three six-sided dice,
     'outcomeList' would be 'list(6,5,1:3)' and 'orderMatters' would be
     TRUE.

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

     A single number representing the probability of getting an outcome
     that meets the constraints of the specified dice-rolling process

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

     Dylan Arena

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

     ## Probability of rolling at least one 6 when rolling four six-sided dice

     getOutcomeProb(ndice = 4,
                    nsides = 6,
                    outcomeList = list(6))

     ## Probability of rolling a 6, followed by a 5, followed by either a 1, 2,
     ## or 3 when rolling three six-sided dice

     getOutcomeProb(ndice = 3,
                    nsides = 6,
                    outcomeList = list(6, 5, 1:3),
                    orderMatters = TRUE)

     ## Probability of rolling no 10's when rolling two ten-sided dice

     getOutcomeProb(ndice = 2,
                    nsides = 10,
                    outcomeList = list(1:9,1:9))

