Learn R Programming

mapfit (version 0.9.6)

ph: Phase-Type (PH) Distribution

Description

Density function, distribution function and random generation for the PH distribution, and a function to generate an object of ph.

Usage

ph(size, alpha, Q, xi, class = "CsparseMatrix")
dph(x, ph = ph(1), log = FALSE)
pph(q, ph = ph(1), lower.tail = TRUE, log.p = FALSE)
rph(n, ph = ph(1))

Arguments

Value

ph gives an object of general PH distribution. dph gives the density function, pph gives the distribution function, and rph generates random samples.

Details

The PH distribution with parameters $alpha$, $Q$ and $xi$: Cumulative probability function; $$F(q) = 1 - alpha \exp( Q q ) 1$$ Probability density function; $$f(x) = alpha \exp( Q x ) xi$$

See Also

cf1, herlang

Examples

Run this code
## create a PH (full matrix) with 5 phases
(param1 <- ph(5))

## create a PH (full matrix) with 5 phases
(param1 <- ph(size=5))

## create a PH with specific parameters
(param2 <- ph(alpha=c(1,0,0), 
	          Q=rbind(c(-4,2,0),c(2,-5,1),c(1,0,-1)),
	          xi=c(2,2,0))) 

## p.d.f. for 0, 0.1, ..., 1
(dph(x=seq(0, 1, 0.1), ph=param2))

## c.d.f. for 0, 0.1, ..., 1
(pph(q=seq(0, 1, 0.1), ph=param2))

## generate 10 samples
(rph(n=10, ph=param2))

Run the code above in your browser using DataLab