mean: mean method for 'cont_phase_type'

Description Usage Arguments Examples

View source: R/mean.R

Description

mean method for cont_phase_type

mean method for disc_phase_type

mean method for mult_cont_phase_type

mean method for mult_disc_phase_type

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
mean(x, ...)

## S3 method for class 'cont_phase_type'
mean(x, ...)

## S3 method for class 'disc_phase_type'
mean(x, ...)

## S3 method for class 'mult_cont_phase_type'
mean(x, v = NULL, ...)

## S3 method for class 'mult_disc_phase_type'
mean(x, v = NULL, ...)

Arguments

x

a cont_phase_type, disc_phase_type, mult_cont_phase_type or mult_disc_phase_type object

...

other arguments passed to methods

v

NULL, integer or vector.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# For univariate continuous phase-type distributions
ph1 <- PH(matrix(c(-3, 0, 0, 1, -2, 0, 0, 1, -1), ncol = 3), c(0.25,0.25,0.5))
mean(ph1)

# For multivariate continuous phase-type distributions
subintensity_matrix <- matrix(c(-3, 0, 0,
                               2, -2, 0,
                               0, 1, -1), nrow = 3, ncol = 3)
reward_matrix = matrix(sample(seq(0, 10), 6), nrow = 3, ncol = 2)
ph2 <- MPH(subintensity_matrix, reward_mat = reward_matrix)
## Mean for both states in the reward matrix
mean(ph2)
## Mean for the first state in the reward matrix
mean(ph2, 1)
## Mean for the second state in the reward matrix
mean(ph2, 2)

rivasiker/phasty documentation built on June 15, 2021, 9:18 p.m.