# ph.moment-method: Moments for Phase-Type (PH) Distribution In mapfit: A Tool for PH/MAP Parameter Estimation

## Description

Moments for PH distribution.

## Usage

 ```1 2 3 4 5 6``` ```ph.mean(ph) ph.var(ph) ## S4 method for signature 'ANY,ph' ph.moment(k, ph, ...) ## S4 method for signature 'ANY,herlang' ph.moment(k, ph, ...) ```

## Arguments

 `ph` an object of S4 class of PH (`ph`) or Hyper-Erlang (`herlang`). `k` an integer of dgrees of moments. `...` further arguments for methods.

## Details

The PH distribution with parameters alpha, Q and xi: k-th moment;

k! α (-Q)^{-k} 1

## Value

`ph.mean` and `ph.var` give mean and variance of PH. `ph.moment` gives a vector of up to k moments.

## Note

`ph.moment` is a generic function for `ph` and `herlang`.

`ph`, `cf1`, `herlang`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26``` ```## create a PH with specific parameters (param1 <- 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))) ## create a CF1 with specific parameters (param2 <- cf1(alpha=c(1,0,0), rate=c(1.0,2.0,3.0))) ## create a hyper Erlang with specific parameters (param3 <- herlang(shape=c(2,3), mixrate=c(0.3,0.7), rate=c(1.0,10.0))) ## mean ph.mean(param1) ph.mean(param2) ph.mean(param3) ## variance ph.var(param1) ph.var(param2) ph.var(param3) ## up to 5 moments ph.moment(5, param1) ph.moment(5, param2) ph.moment(5, param3) ```