Learn R Programming

mapfit (version 0.9.9)

cf1: Canonical Form 1 for Phase-Type (PH) Distribution

Description

A function to generate an object of '>cf1.

Usage

cf1(size, alpha, rate, class = "CsparseMatrix")

Arguments

size

A value for the number of phases.

alpha

A vector for the initial probabilities of PH distribution.

rate

A vector for transition rates to next phase (diagonal elements of Q).

class

Name of Matrix class for Q.

Value

cf1 gives an object of canonical form 1 that is a subclass of PH distribution.

Details

  • The PH distribution with parameters \(\alpha\), \(Q\) and \(\xi = - Q 1\):

  • Cumulative probability function; $$F(q) = 1 - \alpha \exp( Q q ) 1$$

  • Probability density function; $$f(x) = \alpha \exp( Q x ) \xi,$$ where \(Q\) is a bidiagonal matrix whose entries are sorted.

See Also

ph, herlang

Examples

Run this code
# NOT RUN {
## create a CF1 with 5 phases
(param1 <- cf1(5))

## create a CF1 with 5 phases
(param1 <- cf1(size=5))

## create a CF1 with specific parameters
(param2 <- cf1(alpha=c(1,0,0), rate=c(1.0,2.0,3.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 (this is quiker than rph with general ph)
(rph(n=10, ph=param2))

# }

Run the code above in your browser using DataLab