RtoDPQ                 package:distr                 R Documentation

_R_t_o_D_P_Q

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

     function to do get empirical density, cumulative distribution and
     quantile function from random numbers

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

     RtoDPQ(r, e = RtoDPQ.e, n = DefaultNrGridPoints)

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

       r: the random number generator 

       e: 10^e numbers are generated, a higher number leads to a better
          result. 

       n: The number of grid points used to create the approximated
          functions, a higher number leads to a better result.

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

     RtoDPQ generates 10^e random numbers, by default 

                             e = RtoDPQ.e

     . The density is formed on the basis of n points using approxfun
     and density, by default 

                       n = DefaultNrGridPoints

     . The cumulative distribution function and the quantile function
     are also created on the basis of n points using  'approxfun' and
     'ecdf'.  Of course, the results are usually not exact as they rely
     on random numbers.

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

     'RtoDPQ' returns a list of functions. 

   dfun : density 

   pfun : cumulative distribution function 

   qfun : quantile function 

_N_o_t_e:

     Use 'RtoDPQ' for absolutely continuous and 'RtoDPQ.d' for discrete
     distributions.

_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:

     'UnivariateDistribution-class'

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

     rn2 <- function(n){rnorm(n)^2}
     x <- RtoDPQ(r = rn2, e = 4, n = 512)
     # returns density, cumulative distribution and quantile function of
     # squared standard normal distribution
     x$dfun(4)
     RtoDPQ(r = rn2, e = 5, n = 1024) # for a better result

     rp2 <- function(n){rpois(n, lambda = 1)^2}
     x <- RtoDPQ.d(r = rp2, e = 5)
     # returns density, cumulative distribution and quantile function of
     # squared Poisson distribution with parameter lambda=1

