Card                  package:VGAM                  R Documentation

_C_a_r_d_i_o_i_d _D_i_s_t_r_i_b_u_t_i_o_n

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

     Density, distribution function, quantile function and random
     generation for the cardioid distribution.

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

     dcard(x, mu, rho, log=FALSE)
     pcard(q, mu, rho)
     qcard(p, mu, rho, tolerance = 1e-07, maxits = 500)
     rcard(n, mu, rho, ...)

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

    x, q: vector of quantiles.

       p: vector of probabilities.

       n: number of observations. Must be a single positive integer. 

 mu, rho: See 'cardioid' for more information.

tolerance, maxits, ...: The first two are control parameters for the
          algorithm used to solve for the roots of a nonlinear system
          of equations; 'tolerance' controls for the accuracy and
          'maxits' is the maximum number of iterations. 'rcard' calls
          'qcard' so the '...' can be used to vary the two arguments.

     log: Logical. If 'log=TRUE' then the logarithm of the density is
          returned.

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

     See 'cardioid', the 'VGAM' family function for estimating the two
     parameters by maximum likelihood estimation, for the formula of
     the probability density function and other details.

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

     'dcard' gives the density, 'pcard' gives the distribution
     function, 'qcard' gives the quantile function, and 'rcard'
     generates random deviates.

_N_o_t_e:

     Convergence problems might occur with 'rcard'.

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

     Thomas W. Yee

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

     'cardioid'.

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

     ## Not run: 
     mu = 4; rho = 0.4
     x = seq(0, 2*pi, len=501)
     plot(x, dcard(x, mu, rho), type="l", las=1, ylim=c(0,1), col="blue",
          ylab=paste("[dp]card(mu=", mu, ", rho=", rho, ")"),
          main="Blue is density, red is cumulative distribution function",
          sub="Purple lines are the 10,20,...,90 percentiles")
     lines(x, pcard(x, mu, rho), col="red")

     probs = seq(0.1, 0.9, by=0.1)
     Q = qcard(probs, mu, rho)
     lines(Q, dcard(Q, mu, rho), col="purple", lty=3, type="h")
     lines(Q, pcard(Q, mu, rho), col="purple", lty=3, type="h")
     abline(h=c(0,probs,1), v=c(0,2*pi), col="purple", lty=3)
     max(abs(pcard(Q, mu, rho) - probs)) # Should be 0
     ## End(Not run)

