Density, distribution function, quantile function and random generation for the univariate continuous phase-type distribution.

dPH(x, obj)

qPH(p, obj)

pPH(q, obj)

rPH(n, obj)

rFullPH(obj)

Arguments

x, q

vector of quantiles.

obj

an object of class cont_phase_type.

p

vector of probabilities.

n

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

Value

dPH gives the density, pPH gives the distribution function, qPH gives the quantile function, and rPH generates random deviates. rFullPH returns the full path of a random draw from the distribution.

The length of the result is determined by n for rPH, and is the maximum of the lengths of the numerical arguments for the other functions.

The numerical arguments other than n are recycled to the length of the result. Only the first elements of the logical arguments are used.

Functions

  • dPH(): Density function for the univariate continuous phase-type distribution.

  • qPH(): Quantile function for the univariate continuous phase-type distribution.

  • pPH(): Distribution function for the univariate continuous phase-type distribution.

  • rPH(): Random number generator for the univariate continuous phase-type distribution.

  • rFullPH(): Simulation of the full path for the univariate continuous phase-type distribution.

See also

Distributions for other standard distributions.

Examples


cont_phase_type <- matrix(c(-3, 0, 1,
                            2, -3, 1,
                            1, 1, -2), ncol = 3)
Y <- PH(cont_phase_type)
#> Warning: 
#>  The initial probability vector is automatically generated.

dPH(3:4, Y)
#> [1] 0.08879596 0.04274991
pPH(1.45, Y)
#> [1] 0.6202987
qPH(0.5, Y)
#> [1] 1.085021
set.seed(0)
rPH(6, Y)
#> [1] 2.1235576 1.7917798 2.2700540 0.5667907 1.2148449 1.5659480
rFullPH(Y)
#>   state       time
#> 1     1 0.10042767
#> 2     2 0.33151860
#> 3     3 1.00391620
#> 4     1 0.72625752
#> 5     2 0.09485884
#> 6     3 0.27891468
#> 7     1 0.32579860
#> 8     2 0.10314929