pexp                   package:msm                   R Documentation

_E_x_p_o_n_e_n_t_i_a_l _d_i_s_t_r_i_b_u_t_i_o_n _w_i_t_h _p_i_e_c_e_w_i_s_e-_c_o_n_s_t_a_n_t _r_a_t_e

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

     Density, distribution function, quantile function and random
     generation for a generalisation of the exponential distribution,
     in which the rate changes at a series of times.

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

          dpexp(x, rate=1, t=0, log = FALSE)
          ppexp(q, rate=1, t=0, lower.tail = TRUE, log.p = FALSE)
          qpexp(p, rate=1, t=0, lower.tail = TRUE, log.p = FALSE)
          rpexp(n, rate=1, t=0)

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

     x,q: vector of quantiles.

       p: vector of probabilities.

       n: number of observations. If 'length(n) > 1', the length is
          taken to be the number required.

    rate: vector of rates.

       t: vector of the same length as 'rate', giving the times at
          which the rate changes. The first element of 't' should be 0,
          and 't' should be in increasing order.

log, log.p: logical; if TRUE, probabilities p are given as log(p).

lower.tail: logical; if TRUE (default), probabilities are P[X <= x],
          otherwise, P[X > x].

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

     Consider the exponential distribution with rates r1,..., rn
     changing at times t1, ..., tn, with t1 = 0. Suppose tk is the
     maximum ti such that ti < x. The density of this distribution at x
     > 0 is f(x) for k = 1, and 

      prod{i=1 ... k} (1 - F(ti - t{i-1}, r{i-1})) f(x - tk, rk)

     for k > 1. 

     where F() and f() are the distribution and density functions of
     the standard exponential distribution.

     If 'rate' is of length 1, this is just the standard exponential
     distribution.  Therefore, for example, 'dpexp(x)', with no other
     arguments, is simply equivalent to 'dexp(x)'.

     Only 'rpexp' is used in the 'msm' package, to simulate from Markov
     processes with piecewise-constant intensities depending on
     time-dependent covariates.  These functions are merely provided
     for completion, and are not optimized for numerical stability.

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

     'dpexp' gives the density, 'ppexp' gives the distribution
     function, 'qpexp' gives the quantile function, and 'rpexp'
     generates random deviates.

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

     C. H. Jackson chris.jackson@imperial.ac.uk

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

     'dexp', 'sim.msm'.

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

     x <- seq(0.1, 50, by=0.1)
     rate <- c(0.1, 0.2, 0.05, 0.3)
     t <- c(0, 10, 20, 30)
     plot(x, dexp(x, 0.1), type="l") ## standard exponential distribution
     lines(x, dpexp(x, rate, t), type="l", lty=2)  ## distribution with piecewise constant rate
     plot(x, pexp(x, 0.1), type="l") ## standard exponential distribution
     lines(x, ppexp(x, rate, t), type="l", lty=2)  ## distribution with piecewise constant rate

