DiscreteDistribution-class       package:distr       R Documentation

_C_l_a_s_s "_D_i_s_c_r_e_t_e_D_i_s_t_r_i_b_u_t_i_o_n"

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

     The 'DiscreteDistribution'-class is the mother-class of the
     classes 'Binom', 'Dirac', 'Geom', 'Hyper', 'Nbinom' and 'Poisson'.
     Further discrete distributions can be defined either by 
     declaration of own random number generator, density and cumulative
     distribution and quantile functions, or as result of a 
     convolution of two discrete distributions or by application of a
     mathematical operator to a discrete distribution. An  additional
     way is, to specify only the random number generator. The function
     'RtoDPQ.d' then approximates the three  remaining slots 'd', 'p'
     and 'q' by random sampling.

_O_b_j_e_c_t_s _f_r_o_m _t_h_e _C_l_a_s_s:

     Objects can be created by calls of the form
     'new("DiscreteDistribution", r, d, p, q)'. The result of this call
     is a discrete distribution.

_S_l_o_t_s:

     '_i_m_g': Object of class '"Reals"': the space of the image of this
          distribution which has dimension 1 and the name "Real Space" 

     '_p_a_r_a_m': Object of class '"Parameter"': the parameter of this
          distribution, having only the slot name "Parameter of a
          discrete distribution" 

     '_r': Object of class '"function"': generates random numbers

     '_d': Object of class '"function"': density/probability function

     '_p': Object of class '"function"': cumulative distribution
          function

     '_q': Object of class '"function"': quantile function

     '_s_u_p_p_o_r_t': Object of class '"numeric"': a (sorted) vector
          containing the support of the discrete density function

_E_x_t_e_n_d_s:

     Class '"UnivariateDistribution"', directly.
      Class '"Distribution"', by class '"UnivariateDistribution"'.

_M_e_t_h_o_d_s:

     _i_n_i_t_i_a_l_i_z_e 'signature(.Object = "DiscreteDistribution")':
          initialize method 

     _M_a_t_h 'signature(x = "DiscreteDistribution")': application of a
          mathematical function, e.g. 'sin' or 'exp' (does not work
          with 'log'!), to this discrete distribution

     - 'signature(e1 = "DiscreteDistribution")': application of `-' to
          this discrete distribution

     * 'signature(e1 = "DiscreteDistribution", e2 = "numeric")':
          multiplication of this discrete distribution by an object of
          class `numeric'

     / 'signature(e1 = "DiscreteDistribution", e2 = "numeric")':
          division of this discrete distribution by an object of class
          `numeric'

     + 'signature(e1 = "DiscreteDistribution", e2 = "numeric")':
          addition of this discrete distribution to an object of class
          `numeric'

     - 'signature(e1 = "DiscreteDistribution", e2 = "numeric")':
          subtraction of an object of class `numeric' from this
          discrete distribution 

     * 'signature(e1 = "numeric", e2 = "DiscreteDistribution")':
          multiplication of this discrete distribution by an object of
          class `numeric'

     + 'signature(e1 = "numeric", e2 = "DiscreteDistribution")':
          addition of this discrete distribution to an object of class
          `numeric'

     - 'signature(e1 = "numeric", e2 = "DiscreteDistribution")':
          subtraction of this discrete distribution from an object of
          class `numeric'

     + 'signature(e1 = "DiscreteDistribution", e2 =
          "DiscreteDistribution")': Convolution of two discrete
          distributions. The slots p, d and q are approximated by
          grids.

     - 'signature(e1 = "DiscreteDistribution", e2 =
          "DiscreteDistribution")': Convolution of two discrete
          distributions. The slots p, d and q are approximated by
          grids.

     _s_u_p_p_o_r_t 'signature(object = "DiscreteDistribution")': returns the
          support

     _p_l_o_t 'signature(object = "DiscreteDistribution")': plots density,
          cumulative distribution and quantile function 

_N_o_t_e:

     Working with a computer, we use a finite interval as support which
     carries at least mass 1-TruncQuantile.

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

     Thomas Stabla Thomas.Stabla@uni-bayreuth.de,
      Florian Camphausen Florian.Camphausen@uni-bayreuth.de,
      Peter Ruckdeschel Peter.Ruckdeschel@uni-bayreuth.de,
      Matthias Kohl Matthias.Kohl@uni-bayreuth.de

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

     'Parameter-class' 'UnivariateDistribution-class' 'Binom-class'
     'Dirac-class' 'Geom-class' 'Hyper-class' 'Nbinom-class'
     'Pois-class' 'AbscontDistribution-class' 'Reals-class' 'RtoDPQ.d'

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

     B = Binom(prob=0.1,size=10) # B is a Binomial distribution with prob=0.1 and size=10.
     P = Pois(lambda=1) # P is a Poisson distribution with lambda=1.
     D1 = B+1 # a new discrete distributions with exact slots d, p, q
     D2 = D1*3 # a new discrete distributions with exact slots d, p, q
     D3 = B+P # a new discrete distributions with approximated slots d, p, q
     D4 = D1+P # a new discrete distributions with approximated slots d, p, q
     support(D4) # the (approximated) support of this distribution is 1, 2, ..., 21
     r(D4)(1) # one random number generated from this distribution, e.g. 4
     d(D4)(1) # The (approximated) density for x=1 is 0.1282716.
     p(D4)(1) # The (approximated) probability that x<=1 is 0.1282716.
     q(D4)(.5) # The (approximated) 50 percent quantile is 3.

