Title: | Statistics for Matrix Distributions |
---|---|
Description: | Tools for phase-type distributions including the following variants: continuous, discrete, multivariate, in-homogeneous, right-censored, and regression. Methods for functional evaluation, simulation and estimation using the expectation-maximization (EM) algorithm are provided for all models. The methods of this package are based on the following references. Asmussen, S., Nerman, O., & Olsson, M. (1996). Fitting phase-type distributions via the EM algorithm, Olsson, M. (1996). Estimation of phase-type distributions from censored data, Albrecher, H., & Bladt, M. (2019) <doi:10.1017/jpr.2019.60>, Albrecher, H., Bladt, M., & Yslas, J. (2022) <doi:10.1111/sjos.12505>, Albrecher, H., Bladt, M., Bladt, M., & Yslas, J. (2022) <doi:10.1016/j.insmatheco.2022.08.001>, Bladt, M., & Yslas, J. (2022) <doi:10.1080/03461238.2022.2097019>, Bladt, M. (2022) <doi:10.1017/asb.2021.40>, Bladt, M. (2023) <doi:10.1080/10920277.2023.2167833>, Albrecher, H., Bladt, M., & Mueller, A. (2023) <doi:10.1515/demo-2022-0153>, Bladt, M. & Yslas, J. (2023) <doi:10.1016/j.insmatheco.2023.02.008>. |
Authors: | Martin Bladt [aut, cre], Jorge Yslas [aut], Alaric Müller [ctb] |
Maintainer: | Martin Bladt <[email protected]> |
License: | GPL-3 |
Version: | 1.1.9 |
Built: | 2024-11-25 06:54:15 UTC |
Source: | CRAN |
This package implements tools which are useful for the statistical analysis of discrete, continuous, multivariate, right-censored or regression variants of phase-type distributions. These distributions are absorption times of Markov jump processes, and thus the maximization of their likelihood for statistical estimation is best dealt with using the EM algorithm.
Martin Bladt and Jorge Yslas.
Maintainer: Martin Bladt <[email protected]>
Asmussen, S., Nerman, O., & Olsson, M. (1996). Fitting phase-type distributions via the EM algorithm. Scandinavian Journal of Statistics, 23(4),419-441.
Olsson, M. (1996). Estimation of phase-type distributions from censored data. Scandinavian journal of statistics, 24(4), 443-460.
Albrecher, H., & Bladt, M. (2019). Inhomogeneous phase-type distributions and heavy tails. Journal of Applied Probability, 56(4), 1044-1064.
Albrecher, H., Bladt, M., & Yslas, J. (2022). Fitting inhomogeneous Phase-Type distributions to data: The univariate and the multivariate case. Scandinavian Journal of Statistics, 49(1), 44-77
Albrecher, H., Bladt, M., Bladt, M., & Yslas, J. (2020). Mortality modeling and regression with matrix distributions. Insurance: Mathematics and Economics, 107, 68-87.
Bladt, M., & Yslas, J. (2022). Phase-type mixture-of-experts regression for loss severities. ScandinavianActuarialJournal, 1-27.
Bladt, M. (2022). Phase-type distributions for claim severity regression modeling. ASTIN Bulletin: The journal of the IAA, 52(2), 417-448.
Bladt, M. (2023). A tractable class of Multivariate Phase-type distributions for loss modeling. North American Actuarial Journal, to appear.
Albrecher, H., Bladt, M., & Mueller, A. (2023). Joint lifetime modelling with matrix distributions. Dependence Modeling, 11(1), 1-22.
Bladt, M. & Yslas, J. (2023). Robust claim frequency modeling through phase-type mixture-of-experts regression.Insurance: Mathematics and Economics, 111, 1-22.
Sum method for discrete phase-type distributions
## S4 method for signature 'dph,dph' e1 + e2
## S4 method for signature 'dph,dph' e1 + e2
e1 |
An object of class dph. |
e2 |
An object of class dph. |
An object of class dph.
dph1 <- dph(structure = "general", dimension = 3) dph2 <- dph(structure = "general", dimension = 5) dph_sum <- dph1 + dph2 dph_sum
dph1 <- dph(structure = "general", dimension = 3) dph2 <- dph(structure = "general", dimension = 5) dph_sum <- dph1 + dph2 dph_sum
Sum method for phase-type distributions
## S4 method for signature 'ph,ph' e1 + e2
## S4 method for signature 'ph,ph' e1 + e2
e1 |
An object of class ph. |
e2 |
An object of class ph. |
An object of class ph.
ph1 <- ph(structure = "general", dimension = 3) ph2 <- ph(structure = "gcoxian", dimension = 5) ph_sum <- ph1 + ph2 ph_sum
ph1 <- ph(structure = "general", dimension = 3) ph2 <- ph(structure = "gcoxian", dimension = 5) ph_sum <- ph1 + ph2 ph_sum
Runge-Kutta for the calculation of the a vector in a EM step
a_rungekutta(avector, dt, h, S)
a_rungekutta(avector, dt, h, S)
avector |
The a vector. |
dt |
Increment. |
h |
Step-length. |
S |
Sub-intensity matrix. |
Constructor function for bivariate discrete phase-type distributions
bivdph(alpha = NULL, S11 = NULL, S12 = NULL, S22 = NULL, dimensions = c(3, 3))
bivdph(alpha = NULL, S11 = NULL, S12 = NULL, S22 = NULL, dimensions = c(3, 3))
alpha |
A probability vector. |
S11 |
A sub-transition matrix. |
S12 |
A matrix. |
S22 |
A sub-transition matrix. |
dimensions |
The dimensions of the bivariate discrete phase-type (if no parameters are provided). |
An object of class bivdph.
bivdph(dimensions = c(3, 3)) S11 <- matrix(c(0.1, .5, .5, 0.1), 2, 2) S12 <- matrix(c(.2, .3, .2, .1), 2, 2) S22 <- matrix(c(0.2, 0, 0.1, 0.1), 2, 2) bivdph(alpha = c(.5, .5), S11, S12, S22)
bivdph(dimensions = c(3, 3)) S11 <- matrix(c(0.1, .5, .5, 0.1), 2, 2) S12 <- matrix(c(.2, .3, .2, .1), 2, 2) S22 <- matrix(c(0.2, 0, 0.1, 0.1), 2, 2) bivdph(alpha = c(.5, .5), S11, S12, S22)
Bivariate discrete phase-type joint density of the feed forward type
bivdph_density(x, alpha, S11, S12, S22)
bivdph_density(x, alpha, S11, S12, S22)
x |
Matrix of values. |
alpha |
Vector of initial probabilities. |
S11 |
Sub-transition matrix. |
S12 |
Matrix. |
S22 |
Sub-transition matrix. |
Joint density at x
.
Bivariate discrete phase-type joint tail of the feed forward type
bivdph_tail(x, alpha, S11, S12, S22)
bivdph_tail(x, alpha, S11, S12, S22)
x |
Matrix of values. |
alpha |
Vector of initial probabilities. |
S11 |
Sub-transition matrix. |
S12 |
Matrix. |
S22 |
Sub-transition matrix. |
Joint tail at x
.
Class of objects for bivariate discrete phase-type distributions.
Class object.
name
Name of the discrete phase-type distribution.
pars
A list comprising of the parameters.
fit
A list containing estimation information.
Constructor function for bivariate inhomogeneous phase-type distributions
biviph( bivph = NULL, gfun = NULL, gfun_pars = NULL, alpha = NULL, S11 = NULL, S12 = NULL, S22 = NULL, dimensions = c(3, 3) )
biviph( bivph = NULL, gfun = NULL, gfun_pars = NULL, alpha = NULL, S11 = NULL, S12 = NULL, S22 = NULL, dimensions = c(3, 3) )
bivph |
An object of class bivph. |
gfun |
Vector of inhomogeneity transforms. |
gfun_pars |
List of parameters for the inhomogeneity functions. |
alpha |
A probability vector. |
S11 |
A sub-intensity matrix. |
S12 |
A matrix. |
S22 |
A sub-intensity matrix. |
dimensions |
The dimensions of the bivariate phase-type (if no parameters are provided). |
An object of class biviph.
under_bivph <- bivph(dimensions = c(3, 3)) biviph(under_bivph, gfun = c("weibull", "pareto"), gfun_pars = list(c(2), c(3)))
under_bivph <- bivph(dimensions = c(3, 3)) biviph(under_bivph, gfun = c("weibull", "pareto"), gfun_pars = list(c(2), c(3)))
Class of objects for bivariate inhomogeneous phase-type distributions.
Class object.
name
Name of the phase type distribution.
gfun
A list comprising of the parameters.
Constructor function for bivariate phase-type distributions
bivph(alpha = NULL, S11 = NULL, S12 = NULL, S22 = NULL, dimensions = c(3, 3))
bivph(alpha = NULL, S11 = NULL, S12 = NULL, S22 = NULL, dimensions = c(3, 3))
alpha |
A probability vector. |
S11 |
A sub-intensity matrix. |
S12 |
A matrix. |
S22 |
A sub-intensity matrix. |
dimensions |
The dimensions of the bivariate phase-type (if no parameters are provided). |
An object of class bivph.
bivph(dimensions = c(3, 3)) S11 <- matrix(c(-1, .5, .5, -1), 2, 2) S12 <- matrix(c(.2, .4, .3, .1), 2, 2) S22 <- matrix(c(-2, 0, 1, -1), 2, 2) bivph(alpha = c(.5, .5), S11, S12, S22)
bivph(dimensions = c(3, 3)) S11 <- matrix(c(-1, .5, .5, -1), 2, 2) S12 <- matrix(c(.2, .4, .3, .1), 2, 2) S22 <- matrix(c(-2, 0, 1, -1), 2, 2) bivph(alpha = c(.5, .5), S11, S12, S22)
Bivariate phase-type joint density of the feed forward type
bivph_density(x, alpha, S11, S12, S22)
bivph_density(x, alpha, S11, S12, S22)
x |
Matrix of values. |
alpha |
Vector of initial probabilities. |
S11 |
Sub-intensity matrix. |
S12 |
Matrix. |
S22 |
Sub-intensity matrix. |
Joint density at x
.
Bivariate phase-type joint Laplace
bivph_laplace(r, alpha, S11, S12, S22)
bivph_laplace(r, alpha, S11, S12, S22)
r |
Matrix of values. |
alpha |
Vector of initial probabilities. |
S11 |
Sub-intensity matrix. |
S12 |
Matrix. |
S22 |
Sub-intensity matrix. |
Joint laplace at r
.
Bivariate phase-type joint tail of the feed forward type
bivph_tail(x, alpha, S11, S12, S22)
bivph_tail(x, alpha, S11, S12, S22)
x |
Matrix of values. |
alpha |
Vector of initial probabilities. |
S11 |
Sub-intensity matrix. |
S12 |
Matrix. |
S22 |
Sub-intensity matrix. |
Joint tail at x
.
Class of objects for bivariate phase-type distributions.
Class object.
name
Name of the phase-type distribution.
pars
A list comprising of the parameters.
fit
A list containing estimation information.
Methods are available for objects of class ph.
cdf(x, ...)
cdf(x, ...)
x |
An object of the model class. |
... |
Further parameters to be passed on. |
CDF from the matrix distribution.
Distribution method for discrete phase-type distributions
## S4 method for signature 'dph' cdf(x, q, lower.tail = TRUE)
## S4 method for signature 'dph' cdf(x, q, lower.tail = TRUE)
x |
An object of class dph. |
q |
A vector of locations. |
lower.tail |
Logical parameter specifying whether lower tail (CDF) or upper tail is computed. |
A vector containing the CDF evaluations at the given locations.
obj <- dph(structure = "general") cdf(obj, c(1, 2, 3))
obj <- dph(structure = "general") cdf(obj, c(1, 2, 3))
Distribution method for inhomogeneous phase-type distributions
## S4 method for signature 'iph' cdf(x, q, lower.tail = TRUE)
## S4 method for signature 'iph' cdf(x, q, lower.tail = TRUE)
x |
An object of class iph. |
q |
A vector of locations. |
lower.tail |
Logical parameter specifying whether lower tail (CDF) or upper tail is computed. |
A vector containing the CDF evaluations at the given locations.
obj <- iph(ph(structure = "general"), gfun = "weibull", gfun_pars = 2) cdf(obj, c(1, 2, 3))
obj <- iph(ph(structure = "general"), gfun = "weibull", gfun_pars = 2) cdf(obj, c(1, 2, 3))
Distribution method for multivariate inhomogeneous phase-type distributions
## S4 method for signature 'miph' cdf(x, y, lower.tail = TRUE)
## S4 method for signature 'miph' cdf(x, y, lower.tail = TRUE)
x |
An object of class miph. |
y |
A matrix of observations. |
lower.tail |
Logical parameter specifying whether lower tail (CDF) or upper tail is computed. |
A list containing the locations and corresponding CDF evaluations.
under_mph <- mph(structure = c("general", "general")) obj <- miph(under_mph, gfun = c("weibull", "pareto"), gfun_pars = list(c(2), c(3))) cdf(obj, c(1, 2))
under_mph <- mph(structure = c("general", "general")) obj <- miph(under_mph, gfun = c("weibull", "pareto"), gfun_pars = list(c(2), c(3))) cdf(obj, c(1, 2))
Distribution method for multivariate phase-type distributions
## S4 method for signature 'mph' cdf(x, y, lower.tail = TRUE)
## S4 method for signature 'mph' cdf(x, y, lower.tail = TRUE)
x |
An object of class mph. |
y |
A matrix of observations. |
lower.tail |
Logical parameter specifying whether lower tail (CDF) or upper tail is computed. |
A list containing the locations and corresponding CDF evaluations.
obj <- mph(structure = c("general", "general")) cdf(obj, matrix(c(0.5, 1), ncol = 2))
obj <- mph(structure = c("general", "general")) cdf(obj, matrix(c(0.5, 1), ncol = 2))
Distribution method for phase-type distributions
## S4 method for signature 'ph' cdf(x, q, lower.tail = TRUE)
## S4 method for signature 'ph' cdf(x, q, lower.tail = TRUE)
x |
An object of class ph. |
q |
A vector of locations. |
lower.tail |
Logical parameter specifying whether lower tail (CDF) or upper tail is computed. |
A vector containing the CDF evaluations at the given locations.
obj <- ph(structure = "general") cdf(obj, c(1, 2, 3))
obj <- ph(structure = "general") cdf(obj, c(1, 2, 3))
Clone a matrix
clone_matrix(m)
clone_matrix(m)
m |
A matrix. |
A clone of the matrix.
Clone a vector
clone_vector(v)
clone_vector(v)
v |
A vector. |
A clone of the vector.
Coef method for bivdph class
## S4 method for signature 'bivdph' coef(object)
## S4 method for signature 'bivdph' coef(object)
object |
An object of class bivdph. |
Parameters of bivariate discrete phase-type model.
obj <- bivdph(dimensions = c(3, 3)) coef(obj)
obj <- bivdph(dimensions = c(3, 3)) coef(obj)
Coef method for biviph class
## S4 method for signature 'biviph' coef(object)
## S4 method for signature 'biviph' coef(object)
object |
An object of class biviph. |
Parameters of bivariate inhomogeneous phase-type model.
under_bivph <- bivph(dimensions = c(3, 3)) obj <- biviph(under_bivph, gfun = c("weibull", "pareto"), gfun_pars = list(c(2), c(3))) coef(obj)
under_bivph <- bivph(dimensions = c(3, 3)) obj <- biviph(under_bivph, gfun = c("weibull", "pareto"), gfun_pars = list(c(2), c(3))) coef(obj)
Coef method for bivph class
## S4 method for signature 'bivph' coef(object)
## S4 method for signature 'bivph' coef(object)
object |
An object of class bivph. |
Parameters of bivariate phase-type model.
obj <- bivph(dimensions = c(3, 3)) coef(obj)
obj <- bivph(dimensions = c(3, 3)) coef(obj)
Coef method for dph Class
## S4 method for signature 'dph' coef(object)
## S4 method for signature 'dph' coef(object)
object |
An object of class dph. |
Parameters of dph model.
obj <- dph(structure = "general", dim = 3) coef(obj)
obj <- dph(structure = "general", dim = 3) coef(obj)
Coef method for iph class
## S4 method for signature 'iph' coef(object)
## S4 method for signature 'iph' coef(object)
object |
An object of class iph. |
Parameters of iph model.
obj <- iph(ph(structure = "general", dimension = 2), gfun = "lognormal", gfun_pars = 2) coef(obj)
obj <- iph(ph(structure = "general", dimension = 2), gfun = "lognormal", gfun_pars = 2) coef(obj)
Coef method for mdph class
## S4 method for signature 'mdph' coef(object)
## S4 method for signature 'mdph' coef(object)
object |
An object of class mdph. |
Parameters of multivariate discrete phase-type model.
obj <- mdph(structure = c("general", "general")) coef(obj)
obj <- mdph(structure = c("general", "general")) coef(obj)
Coef method for ph class
## S4 method for signature 'ph' coef(object)
## S4 method for signature 'ph' coef(object)
object |
An object of class ph. |
Parameters of ph model.
obj <- ph(structure = "general") coef(obj)
obj <- ph(structure = "general") coef(obj)
Coef method for sph Class
## S4 method for signature 'sph' coef(object)
## S4 method for signature 'sph' coef(object)
object |
An object of class sph. |
Parameters of sph model.
Cor method for bivdph class
## S4 method for signature 'bivdph' cor(x)
## S4 method for signature 'bivdph' cor(x)
x |
An object of class bivdph. |
The correlation matrix of the bivariate discrete phase-type distribution.
obj <- bivdph(dimensions = c(3, 3)) cor(obj)
obj <- bivdph(dimensions = c(3, 3)) cor(obj)
Cor method for bivph class
## S4 method for signature 'bivph' cor(x)
## S4 method for signature 'bivph' cor(x)
x |
An object of class bivph. |
The correlation matrix of the bivariate phase-type distribution.
obj <- bivph(dimensions = c(3, 3)) cor(obj)
obj <- bivph(dimensions = c(3, 3)) cor(obj)
Cor method for multivariate discrete phase-type distributions
## S4 method for signature 'mdph' cor(x)
## S4 method for signature 'mdph' cor(x)
x |
An object of class mdph. |
The correlation matrix of the multivariate discrete phase-type distribution.
obj <- mdph(structure = c("general", "general")) cor(obj)
obj <- mdph(structure = c("general", "general")) cor(obj)
Cor method for multivariate phase-type distributions
## S4 method for signature 'mph' cor(x)
## S4 method for signature 'mph' cor(x)
x |
An object of class mph. |
The correlation matrix of the multivariate phase-type distribution.
obj <- mph(structure = c("general", "general")) cor(obj)
obj <- mph(structure = c("general", "general")) cor(obj)
Cor method for MPHstar class
## S4 method for signature 'MPHstar' cor(x)
## S4 method for signature 'MPHstar' cor(x)
x |
An object of class MPHstar. |
The correlation matrix of the MPHstar distribution.
obj <- MPHstar(structure = "general") cor(obj)
obj <- MPHstar(structure = "general") cor(obj)
Creates a new matrix with entries the cumulated rows of A
.
cumulate_matrix(A)
cumulate_matrix(A)
A |
A matrix. |
The cumulated matrix.
Creates a new vector with entries the cumulated entries of A
.
cumulate_vector(A)
cumulate_vector(A)
A |
A vector. |
The cumulated vector.
Computes the default step length for a matrix S
to be employed in the
RK method.
default_step_length(S)
default_step_length(S)
S |
Sub-intensity matrix. |
The step length for S
.
Methods are available for objects of class ph.
dens(x, ...)
dens(x, ...)
x |
An object of the model class. |
... |
Further parameters to be passed on. |
Density from the matrix distribution.
Density method for bivariate discrete phase-type distributions
## S4 method for signature 'bivdph' dens(x, y)
## S4 method for signature 'bivdph' dens(x, y)
x |
An object of class bivdph. |
y |
A matrix of locations. |
A vector containing the joint density evaluations at the given locations.
obj <- bivdph(dimensions = c(3, 3)) dens(obj, matrix(c(1, 2), ncol = 2))
obj <- bivdph(dimensions = c(3, 3)) dens(obj, matrix(c(1, 2), ncol = 2))
Density method for bivariate inhomogeneous phase-type distributions
## S4 method for signature 'biviph' dens(x, y)
## S4 method for signature 'biviph' dens(x, y)
x |
An object of class biviph. |
y |
A matrix of locations. |
A vector containing the joint density evaluations at the given locations.
under_bivph <- bivph(dimensions = c(3, 3)) obj <- biviph(under_bivph, gfun = c("weibull", "pareto"), gfun_pars = list(c(2), c(3))) dens(obj, matrix(c(0.5, 1), ncol = 2))
under_bivph <- bivph(dimensions = c(3, 3)) obj <- biviph(under_bivph, gfun = c("weibull", "pareto"), gfun_pars = list(c(2), c(3))) dens(obj, matrix(c(0.5, 1), ncol = 2))
Density method for bivariate phase-type distributions
## S4 method for signature 'bivph' dens(x, y)
## S4 method for signature 'bivph' dens(x, y)
x |
An object of class bivph. |
y |
A matrix of locations. |
A vector containing the joint density evaluations at the given locations.
obj <- bivph(dimensions = c(3, 3)) dens(obj, matrix(c(0.5, 1), ncol = 2))
obj <- bivph(dimensions = c(3, 3)) dens(obj, matrix(c(0.5, 1), ncol = 2))
Density method for discrete phase-type distributions
## S4 method for signature 'dph' dens(x, y)
## S4 method for signature 'dph' dens(x, y)
x |
An object of class dph. |
y |
A vector of locations. |
A vector containing the density evaluations at the given locations.
obj <- dph(structure = "general") dens(obj, c(1, 2, 3))
obj <- dph(structure = "general") dens(obj, c(1, 2, 3))
Density method for inhomogeneous phase-type distributions
## S4 method for signature 'iph' dens(x, y)
## S4 method for signature 'iph' dens(x, y)
x |
An object of class iph. |
y |
A vector of locations. |
A vector containing the density evaluations at the given locations.
obj <- iph(ph(structure = "general"), gfun = "weibull", gfun_pars = 2) dens(obj, c(1, 2, 3))
obj <- iph(ph(structure = "general"), gfun = "weibull", gfun_pars = 2) dens(obj, c(1, 2, 3))
Density method for multivariate discrete phase-type distributions
## S4 method for signature 'mdph' dens(x, y)
## S4 method for signature 'mdph' dens(x, y)
x |
An object of class mdph. |
y |
A matrix of locations. |
A vector containing the joint density evaluations at the given locations.
obj <- mdph(structure = c("general", "general")) dens(obj, matrix(c(1, 1), ncol = 2))
obj <- mdph(structure = c("general", "general")) dens(obj, matrix(c(1, 1), ncol = 2))
Density method for multivariate inhomogeneous phase-type distributions
## S4 method for signature 'miph' dens(x, y, delta = NULL)
## S4 method for signature 'miph' dens(x, y, delta = NULL)
x |
An object of class miph. |
y |
A matrix of observations. |
delta |
Matrix with right-censoring indicators (1 uncensored, 0 right censored). |
A list containing the locations and corresponding density evaluations.
under_mph <- mph(structure = c("general", "general")) obj <- miph(under_mph, gfun = c("weibull", "pareto"), gfun_pars = list(c(2), c(3))) dens(obj, c(1, 2))
under_mph <- mph(structure = c("general", "general")) obj <- miph(under_mph, gfun = c("weibull", "pareto"), gfun_pars = list(c(2), c(3))) dens(obj, c(1, 2))
Density method for multivariate phase-type distributions
## S4 method for signature 'mph' dens(x, y, delta = NULL)
## S4 method for signature 'mph' dens(x, y, delta = NULL)
x |
An object of class mph. |
y |
A matrix of observations. |
delta |
Matrix with right-censoring indicators (1 uncensored, 0 right censored). |
A list containing the locations and corresponding density evaluations.
obj <- mph(structure = c("general", "general")) dens(obj, matrix(c(0.5, 1), ncol = 2))
obj <- mph(structure = c("general", "general")) dens(obj, matrix(c(0.5, 1), ncol = 2))
Density method for phase-type distributions
## S4 method for signature 'ph' dens(x, y)
## S4 method for signature 'ph' dens(x, y)
x |
An object of class ph. |
y |
A vector of locations. |
A vector containing the density evaluations at the given locations.
obj <- ph(structure = "general") dens(obj, c(1, 2, 3))
obj <- ph(structure = "general") dens(obj, c(1, 2, 3))
Constructor function for discrete phase-type distributions
dph(alpha = NULL, S = NULL, structure = NULL, dimension = 3)
dph(alpha = NULL, S = NULL, structure = NULL, dimension = 3)
alpha |
A probability vector. |
S |
A sub-transition matrix. |
structure |
A valid dph structure: |
dimension |
The dimension of the dph structure (if structure is provided). |
An object of class dph.
dph(structure = "general", dim = 5) dph(alpha = c(0.5, 0.5), S = matrix(c(0.1, 0.5, 0.5, 0.2), 2, 2))
dph(structure = "general", dim = 5) dph(alpha = c(0.5, 0.5), S = matrix(c(0.1, 0.5, 0.5, 0.2), 2, 2))
Computes the pgf at z
of a discrete phase-type distribution with
parameters alpha
and S
.
dph_pgf(z, alpha, S)
dph_pgf(z, alpha, S)
z |
Vector of real values. |
alpha |
Vector of initial probabilities. |
S |
Sub-transition matrix. |
Laplace transform at r
.
Class of objects for discrete phase-type distributions.
Class object.
name
Name of the discrete phase-type distribution.
pars
A list comprising of the parameters.
fit
A list containing estimation information.
Computes the cdf (tail) of a discrete phase-type distribution with parameters
alpha
and S
at x
.
dphcdf(x, alpha, S, lower_tail = TRUE)
dphcdf(x, alpha, S, lower_tail = TRUE)
x |
Non-negative value. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
lower_tail |
Cdf or tail. |
The cdf (tail) at x
.
Computes the density of discrete phase-type distribution with parameters
alpha
and S
at x
.
dphdensity(x, alpha, S)
dphdensity(x, alpha, S)
x |
Non-negative value. |
alpha |
Initial probabilities. |
S |
Sub-transition matrix. |
The density at x
.
EM step for the mPH class with right-censoring, for different marginal sub-intensity matrices
EM_step_mPH_rc(alpha, S_list, y, delta, h)
EM_step_mPH_rc(alpha, S_list, y, delta, h)
alpha |
Common initial distribution vector. |
S_list |
List of marginal sub-intensity matrices. |
y |
Matrix of marginal observations. |
delta |
Matrix with right-censoring indications (1 uncensored, 0 right-censored). |
h |
Tolerance of uniformization. |
Returns the transition probabilities of the embedded Markov chain determined the sub-intensity matrix.
embedded_mc(S)
embedded_mc(S)
S |
A sub-intensity matrix. |
The embedded Markov chain.
EM for discrete bivariate phase-type
EMstep_bivdph(alpha, S11, S12, S22, obs, weight)
EMstep_bivdph(alpha, S11, S12, S22, obs, weight)
alpha |
Initial probabilities. |
S11 |
Sub-transition matrix. |
S12 |
Matrix. |
S22 |
Sub-transition matrix. |
obs |
The observations. |
weight |
The weights for the observations. |
EM for discrete bivariate phase-type MoE
EMstep_bivdph_MoE(alpha, S11, S12, S22, obs, weight)
EMstep_bivdph_MoE(alpha, S11, S12, S22, obs, weight)
alpha |
Initial probabilities. |
S11 |
Sub-transition matrix. |
S12 |
Matrix. |
S22 |
Sub-transition matrix. |
obs |
The observations. |
weight |
The weights for the observations. |
EM for bivariate phase-type distributions using Pade for matrix exponential
EMstep_bivph(alpha, S11, S12, S22, obs, weight)
EMstep_bivph(alpha, S11, S12, S22, obs, weight)
alpha |
Initial probabilities. |
S11 |
Sub-intensity. |
S12 |
A matrix. |
S22 |
Sub-intensity. |
obs |
The observations. |
weight |
The weights for the observations. |
Fitted alpha, S11, S12 and S22 after one iteration.
EM for discrete phase-type
EMstep_dph(alpha, S, obs, weight)
EMstep_dph(alpha, S, obs, weight)
alpha |
Initial probabilities. |
S |
Sub-transition matrix. |
obs |
The observations. |
weight |
The weights for the observations. |
EM for discrete phase-type MoE
EMstep_dph_MoE(alpha, S, obs, weight)
EMstep_dph_MoE(alpha, S, obs, weight)
alpha |
Initial probabilities. |
S |
Sub-transition matrix. |
obs |
The observations. |
weight |
The weights for the observations. |
EM for multivariate discrete phase-type
EMstep_mdph(alpha, S_list, obs, weight)
EMstep_mdph(alpha, S_list, obs, weight)
alpha |
Initial probabilities. |
S_list |
List of marginal sub-transition matrices. |
obs |
The observations. |
weight |
The weights for the observations. |
EM for multivariate discrete phase-type MoE
EMstep_mdph_MoE(alpha, S_list, obs, weight)
EMstep_mdph_MoE(alpha, S_list, obs, weight)
alpha |
Initial probabilities. |
S_list |
List of marginal sub-transition matrices. |
obs |
The observations. |
weight |
The weights for the observations. |
No recycling of information
EMstep_MoE_PADE(alpha, S, obs, weight, rcens, rcweight)
EMstep_MoE_PADE(alpha, S, obs, weight, rcens, rcweight)
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
obs |
The observations. |
weight |
The weights for the observations. |
rcens |
Censored observations. |
rcweight |
The weights for the censored observations. |
EM for phase-type distributions using Pade approximation for matrix exponential
EMstep_PADE(h, alpha, S, obs, weight, rcens, rcweight)
EMstep_PADE(h, alpha, S, obs, weight, rcens, rcweight)
h |
Nuisance parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
obs |
The observations. |
weight |
The weights for the observations. |
rcens |
Censored observations. |
rcweight |
The weights for the censored observations. |
Computes one step of the EM algorithm by using a Runge-Kutta method of fourth order.
EMstep_RK(h, alpha, S, obs, weight, rcens, rcweight)
EMstep_RK(h, alpha, S, obs, weight, rcens, rcweight)
h |
Step-length. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
obs |
The observations. |
weight |
The weights for the observations. |
rcens |
Censored observations. |
rcweight |
The weights for the censored observations. |
EM for phase-type using uniformization for matrix exponential
EMstep_UNI(h, alpha, S, obs, weight, rcens, rcweight)
EMstep_UNI(h, alpha, S, obs, weight, rcens, rcweight)
h |
Positive parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
obs |
The observations. |
weight |
The weights for the observations. |
rcens |
Censored observations. |
rcweight |
The weights for the censored observations. |
Methods are available for objects of class sph.
evaluate(x, subject, ...)
evaluate(x, subject, ...)
x |
An object of the model class. |
subject |
A vector of data. |
... |
Further parameters to be passed on. |
Evaluation method for sph Class
## S4 method for signature 'sph' evaluate(x, subject)
## S4 method for signature 'sph' evaluate(x, subject)
x |
An object of class sph. |
subject |
Covariates of a single subject. |
A ph model.
expm terms of phase-type likelihood using uniformization
expm_terms(h, S, obs)
expm_terms(h, S, obs)
h |
Positive parameter. |
S |
Sub-intensity matrix. |
obs |
The observations. |
Armadillo matrix exponential implementation.
expmat(A)
expmat(A)
A |
A matrix. |
exp(A).
Find n such that P(N > n) = h with N Poisson distributed
find_n(h, lambda)
find_n(h, lambda)
h |
Probability. |
lambda |
Mean of Poisson random variable. |
Integer satisfying condition.
Find weight of observations
find_weight(x)
find_weight(x)
x |
A vector of observations from which we want to know their weights. |
A matrix with unique observations as first column and associated weights for second column.
Methods are available for objects of class sph.
Fisher(x, ...)
Fisher(x, ...)
x |
An object of the model class. |
... |
Further parameters to be passed on. |
Fisher information method for sph class
## S4 method for signature 'sph' Fisher(x, y, X, w = numeric(0))
## S4 method for signature 'sph' Fisher(x, y, X, w = numeric(0))
x |
An object of class sph. |
y |
Independent variate. |
X |
Matrix of covariates. |
w |
Weights. |
A matrix.
Methods are available for objects of class ph.
fit(x, y, ...)
fit(x, y, ...)
x |
An object of the model class. |
y |
A vector of data. |
... |
Further parameters to be passed on. |
An object of the fitted model class.
Fit method for bivdph Class
## S4 method for signature 'bivdph' fit(x, y, weight = numeric(0), stepsEM = 1000, every = 10)
## S4 method for signature 'bivdph' fit(x, y, weight = numeric(0), stepsEM = 1000, every = 10)
x |
An object of class bivdph. |
y |
A matrix with the data. |
weight |
Vector of weights. |
stepsEM |
Number of EM steps to be performed. |
every |
Number of iterations between likelihood display updates. |
An object of class bivdph.
obj <- bivdph(dimensions = c(3, 3)) data <- sim(obj, n = 100) fit(obj, data, stepsEM = 100, every = 50)
obj <- bivdph(dimensions = c(3, 3)) data <- sim(obj, n = 100) fit(obj, data, stepsEM = 100, every = 50)
Fit method for bivph Class
## S4 method for signature 'bivph' fit( x, y, weight = numeric(0), stepsEM = 1000, maxit = 100, reltol = 1e-08, every = 10 )
## S4 method for signature 'bivph' fit( x, y, weight = numeric(0), stepsEM = 1000, maxit = 100, reltol = 1e-08, every = 10 )
x |
An object of class bivph. |
y |
A matrix with the data. |
weight |
Vector of weights. |
stepsEM |
Number of EM steps to be performed. |
maxit |
Maximum number of iterations when optimizing g functions. |
reltol |
Relative tolerance when optimizing g functions. |
every |
Number of iterations between likelihood display updates. |
An object of class bivph.
obj <- bivph(dimensions = c(3, 3)) data <- sim(obj, n = 100) fit(obj, data, stepsEM = 100, every = 50)
obj <- bivph(dimensions = c(3, 3)) data <- sim(obj, n = 100) fit(obj, data, stepsEM = 100, every = 50)
Fit method for dph class
## S4 method for signature 'dph' fit(x, y, weight = numeric(0), stepsEM = 1000, every = 100)
## S4 method for signature 'dph' fit(x, y, weight = numeric(0), stepsEM = 1000, every = 100)
x |
An object of class dph. |
y |
Vector or data. |
weight |
Vector of weights. |
stepsEM |
Number of EM steps to be performed. |
every |
Number of iterations between likelihood display updates. |
An object of class dph.
obj <- dph(structure = "general", dimension = 2) data <- sim(obj, n = 100) fit(obj, data, stepsEM = 100, every = 20)
obj <- dph(structure = "general", dimension = 2) data <- sim(obj, n = 100) fit(obj, data, stepsEM = 100, every = 20)
Fit method for mdph Class
## S4 method for signature 'mdph' fit(x, y, weight = numeric(0), stepsEM = 1000, every = 10)
## S4 method for signature 'mdph' fit(x, y, weight = numeric(0), stepsEM = 1000, every = 10)
x |
An object of class mdph. |
y |
A matrix with the data. |
weight |
Vector of weights. |
stepsEM |
Number of EM steps to be performed. |
every |
Number of iterations between likelihood display updates. |
An object of class mdph.
obj <- mdph(structure = c("general", "general")) data <- sim(obj, n = 100) fit(obj, data, stepsEM = 100, every = 50)
obj <- mdph(structure = c("general", "general")) data <- sim(obj, n = 100) fit(obj, data, stepsEM = 100, every = 50)
Fit method for mph Class
## S4 method for signature 'mph' fit( x, y, delta = numeric(0), stepsEM = 1000, equal_marginals = FALSE, r = 1, maxit = 100, reltol = 1e-08 )
## S4 method for signature 'mph' fit( x, y, delta = numeric(0), stepsEM = 1000, equal_marginals = FALSE, r = 1, maxit = 100, reltol = 1e-08 )
x |
An object of class mph. |
y |
Matrix of data. |
delta |
Matrix with right-censoring indicators (1 uncensored, 0 right censored). |
stepsEM |
Number of EM steps to be performed. |
equal_marginals |
Logical. If |
r |
Sub-sampling parameter, defaults to 1. |
maxit |
Maximum number of iterations when optimizing g function. |
reltol |
Relative tolerance when optimizing g function. |
obj <- mph(structure = c("general", "coxian")) data <- sim(obj, 100) fit(x = obj, y = data, stepsEM = 20)
obj <- mph(structure = c("general", "coxian")) data <- sim(obj, 100) fit(x = obj, y = data, stepsEM = 20)
Fit method for mph class
## S4 method for signature 'MPHstar' fit( x, y, weight = numeric(0), stepsEM = 1000, uni_epsilon = 1e-04, zero_tol = 1e-04, every = 100, plot = F, r = 1, replace = F )
## S4 method for signature 'MPHstar' fit( x, y, weight = numeric(0), stepsEM = 1000, uni_epsilon = 1e-04, zero_tol = 1e-04, every = 100, plot = F, r = 1, replace = F )
x |
An object of class MPHstar. |
y |
A matrix of marginal data. |
weight |
A matrix of marginal weights. |
stepsEM |
The number of EM steps to be performed, defaults to 1000. |
uni_epsilon |
The epsilon parameter for the uniformization method, defaults to 1e-4. |
zero_tol |
The smallest value that a reward can take (to avoid numerical instability), defaults to 1e-4. |
every |
The number of iterations between likelihood display updates. The originating distribution is used, given that there is no explicit density. |
plot |
Boolean that determines if the plot of the loglikelihood evolution is plotted, defaults to False. |
r |
The sub-sampling proportion for stochastic EM, defaults to 1. |
replace |
Boolean that determines if sub-sampling is done with replacement or not, defaults to False. |
An object of class MPHstar.
set.seed(123) obj <- MPHstar(structure = "general") data <- sim(obj, 100) fit(obj, data, stepsEM = 20)
set.seed(123) obj <- MPHstar(structure = "general") data <- sim(obj, 100) fit(obj, data, stepsEM = 20)
Fit method for ph class
## S4 method for signature 'ph' fit( x, y, weight = numeric(0), rcen = numeric(0), rcenweight = numeric(0), stepsEM = 1000, methods = c("RK", "RK"), rkstep = NA, uni_epsilon = NA, maxit = 100, reltol = 1e-08, every = 100, r = 1 )
## S4 method for signature 'ph' fit( x, y, weight = numeric(0), rcen = numeric(0), rcenweight = numeric(0), stepsEM = 1000, methods = c("RK", "RK"), rkstep = NA, uni_epsilon = NA, maxit = 100, reltol = 1e-08, every = 100, r = 1 )
x |
An object of class ph. |
y |
Vector or data. |
weight |
Vector of weights. |
rcen |
Vector of right-censored observations. |
rcenweight |
Vector of weights for right-censored observations. |
stepsEM |
Number of EM steps to be performed. |
methods |
Methods to use for matrix exponential calculation: RM, UNI or PADE. |
rkstep |
Runge-Kutta step size (optional). |
uni_epsilon |
Epsilon parameter for uniformization method. |
maxit |
Maximum number of iterations when optimizing g function. |
reltol |
Relative tolerance when optimizing g function. |
every |
Number of iterations between likelihood display updates. |
r |
Sub-sampling proportion for stochastic EM, defaults to 1. |
An object of class ph.
obj <- iph(ph(structure = "general", dimension = 2), gfun = "weibull", gfun_pars = 2) data <- sim(obj, n = 100) fit(obj, data, stepsEM = 100, every = 20)
obj <- iph(ph(structure = "general", dimension = 2), gfun = "weibull", gfun_pars = 2) data <- sim(obj, n = 100) fit(obj, data, stepsEM = 100, every = 20)
Methods are available for objects of class ph.
haz(x, ...)
haz(x, ...)
x |
An object of the model class. |
... |
Further parameters to be passed on. |
Hazard rate from the matrix distribution.
Hazard rate method for phase-type distributions
## S4 method for signature 'ph' haz(x, y)
## S4 method for signature 'ph' haz(x, y)
x |
An object of class ph. |
y |
A vector of locations. |
A vector containing the hazard rate evaluations at the given locations.
obj <- ph(structure = "general") haz(obj, c(1, 2, 3))
obj <- ph(structure = "general") haz(obj, c(1, 2, 3))
Computes the L inf norm of a matrix A
, which is defined as:
L_inf(A) = max(1 <= i <= M) sum(1 <= j <= N) abs(A(i,j)).
inf_norm(A)
inf_norm(A)
A |
A matrix. |
The L inf norm.
Given the accumulated values of the initial probabilities alpha
and a
uniform value u
, it returns the initial state of a Markov jump process.
This corresponds to the states satisfying cum_alpha_(k-1) < u < cum_alpha_(k).
initial_state(cum_alpha, u)
initial_state(cum_alpha, u)
cum_alpha |
A cummulated vector of initial probabilities. |
u |
Random value in (0,1). |
Initial state of the Markov jump process.
Constructor function for inhomogeneous phase-type distributions
iph( ph = NULL, gfun = NULL, gfun_pars = NULL, alpha = NULL, S = NULL, structure = NULL, dimension = 3, scale = 1 )
iph( ph = NULL, gfun = NULL, gfun_pars = NULL, alpha = NULL, S = NULL, structure = NULL, dimension = 3, scale = 1 )
ph |
An object of class ph. |
gfun |
Inhomogeneity transform. |
gfun_pars |
The parameters of the inhomogeneity function. |
alpha |
A probability vector. |
S |
A sub-intensity matrix. |
structure |
A valid ph structure. |
dimension |
The dimension of the ph structure (if provided). |
scale |
Scale. |
An object of class iph.
iph(ph(structure = "coxian", dimension = 4), gfun = "pareto", gfun_pars = 3)
iph(ph(structure = "coxian", dimension = 4), gfun = "pareto", gfun_pars = 3)
Class of objects for inhomogeneous phase-type distributions.
Class object.
name
Name of the phase-type distribution.
gfun
A list comprising of the parameters.
scale
Scale.
Methods are available for objects of class ph.
laplace(x, ...)
laplace(x, ...)
x |
An object of the model class. |
... |
Further parameters to be passed on. |
Laplace transform of the matrix distribution.
Laplace method for bivph class
## S4 method for signature 'bivph' laplace(x, r)
## S4 method for signature 'bivph' laplace(x, r)
x |
An object of class mph. |
r |
A matrix of real values. |
A vector containing the corresponding Laplace transform evaluations.
obj <- bivph(dimensions = c(3, 3)) laplace(obj, matrix(c(0.5, 1), ncol = 2))
obj <- bivph(dimensions = c(3, 3)) laplace(obj, matrix(c(0.5, 1), ncol = 2))
Laplace method for multivariate phase-type distributions
## S4 method for signature 'mph' laplace(x, r)
## S4 method for signature 'mph' laplace(x, r)
x |
An object of class mph. |
r |
A matrix of real values. |
A vector containing the corresponding Laplace transform evaluations.
set.seed(123) obj <- mph(structure = c("general", "general")) laplace(obj, matrix(c(0.5, 1), ncol = 2))
set.seed(123) obj <- mph(structure = c("general", "general")) laplace(obj, matrix(c(0.5, 1), ncol = 2))
Laplace method for phase-type distributions
## S4 method for signature 'ph' laplace(x, r)
## S4 method for signature 'ph' laplace(x, r)
x |
An object of class ph. |
r |
A vector of real values. |
The Laplace transform of the ph (or underlying ph) object at the given locations.
set.seed(123) obj <- ph(structure = "general", dimension = 3) laplace(obj, 3)
set.seed(123) obj <- ph(structure = "general", dimension = 3) laplace(obj, 3)
Methods are available for objects of multivariate classes.
linCom(x, ...)
linCom(x, ...)
x |
An object of the model class. |
... |
Further parameters to be passed on. |
Marginal of the matrix distribution.
Linear combination method for bivariate phase-type distributions
## S4 method for signature 'bivph' linCom(x, w = c(1, 1))
## S4 method for signature 'bivph' linCom(x, w = c(1, 1))
x |
An object of class bivph. |
w |
A vector with non-negative entries. |
An object of class ph.
obj <- bivph(dimensions = c(3, 3)) linCom(obj, c(1, 0))
obj <- bivph(dimensions = c(3, 3)) linCom(obj, c(1, 0))
Linear combination method for MPHstar class
## S4 method for signature 'MPHstar' linCom(x, w)
## S4 method for signature 'MPHstar' linCom(x, w)
x |
An object of class MPHstar. |
w |
A vector with non-negative entries. |
An object of class ph.
obj <- MPHstar(structure = "general") linCom(obj, c(1, 0))
obj <- MPHstar(structure = "general") linCom(obj, c(1, 0))
Computes PH parameters of a linear combination of vector from MPHstar
linear_combination(w, alpha, S, R)
linear_combination(w, alpha, S, R)
w |
Vector with weights. |
alpha |
Initial distribution vector. |
S |
Sub-intensity matrix. |
R |
Reward matrix. |
A list of PH parameters.
Loglikelihood method for ph class
## S4 method for signature 'ph' logLik(object)
## S4 method for signature 'ph' logLik(object)
object |
An object of class ph. |
An object of class logLik.
obj <- iph(ph(structure = "general", dimension = 2), gfun = "weibull", gfun_pars = 2) data <- sim(obj, n = 100) fitted_ph <- fit(obj, data, stepsEM = 10) logLik(fitted_ph)
obj <- iph(ph(structure = "general", dimension = 2), gfun = "weibull", gfun_pars = 2) data <- sim(obj, n = 100) fitted_ph <- fit(obj, data, stepsEM = 10) logLik(fitted_ph)
Loglikelihood for bivariate discrete phase-type
logLikelihoodbivDPH(alpha, S11, S12, S22, obs, weight)
logLikelihoodbivDPH(alpha, S11, S12, S22, obs, weight)
alpha |
Initial probabilities. |
S11 |
Sub-transition matrix. |
S12 |
Matrix. |
S22 |
Sub-transition matrix. |
obs |
The observations. |
weight |
The weights of the observations. |
Loglikelihood for bivariate discrete phase-type MoE
logLikelihoodbivDPH_MoE(alpha, S11, S12, S22, obs, weight)
logLikelihoodbivDPH_MoE(alpha, S11, S12, S22, obs, weight)
alpha |
Initial probabilities. |
S11 |
Sub-transition matrix. |
S12 |
Matrix. |
S22 |
Sub-transition matrix. |
obs |
The observations. |
weight |
The weights of the observations. |
Loglikelihood for Bivariate PH
logLikelihoodbivPH(alpha, S11, S12, S22, obs, weight)
logLikelihoodbivPH(alpha, S11, S12, S22, obs, weight)
alpha |
Vector of initial probabilities. |
S11 |
Sub-intensity matrix. |
S12 |
Matrix. |
S22 |
Sub-intensity matrix. |
obs |
The observations. |
weight |
The weights of the observations. |
Loglikelihood for discrete phase-type
logLikelihoodDPH(alpha, S, obs, weight)
logLikelihoodDPH(alpha, S, obs, weight)
alpha |
Initial probabilities. |
S |
Sub-transition matrix. |
obs |
The observations. |
weight |
The weights of the observations. |
Loglikelihood for discrete phase-type MoE
logLikelihoodDPH_MoE(alpha, S, obs, weight)
logLikelihoodDPH_MoE(alpha, S, obs, weight)
alpha |
Initial probabilities. |
S |
Sub-transition matrix. |
obs |
The observations. |
weight |
The weights of the observations. |
Loglikelihood for multivariate discrete phase-type
logLikelihoodmDPH(alpha, S_list, obs, weight)
logLikelihoodmDPH(alpha, S_list, obs, weight)
alpha |
Initial probabilities. |
S_list |
List of marginal sub-transition matrices. |
obs |
The observations. |
weight |
The weights of the observations. |
Loglikelihood for multivariate discrete phase-type MoE
logLikelihoodmDPH_MoE(alpha, S_list, obs, weight)
logLikelihoodmDPH_MoE(alpha, S_list, obs, weight)
alpha |
Initial probabilities. |
S_list |
List of marginal sub-transition matrices. |
obs |
The observations. |
weight |
The weights of the observations. |
Loglikelihood for a sample
logLikelihoodMgev_PADE(h, alpha, S, beta, obs, weight, rcens, rcweight)
logLikelihoodMgev_PADE(h, alpha, S, beta, obs, weight, rcens, rcweight)
h |
Nuisance parameter. |
alpha |
Initial probabilities. |
S |
sub-intensity matrix. |
beta |
Inhomogeneity parameter. |
obs |
The observations. |
weight |
The weights of the observations. |
rcens |
Censored observations. |
rcweight |
The weights of the censored observations. |
Loglikelihood for a sample.
logLikelihoodMgev_RK(h, alpha, S, beta, obs, weight, rcens, rcweight)
logLikelihoodMgev_RK(h, alpha, S, beta, obs, weight, rcens, rcweight)
h |
Step-length. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Parameter of transformation |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
Censored observations. |
rcweight |
Weights of the censored observations. |
Loglikelihood for a sample.
logLikelihoodMgev_UNI(h, alpha, S, beta, obs, weight, rcens, rcweight)
logLikelihoodMgev_UNI(h, alpha, S, beta, obs, weight, rcens, rcweight)
h |
Positive parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Parameter of transformation. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
censored observations. |
rcweight |
Weights of the censored observations. |
Loglikelihood for a sample.
logLikelihoodMgompertz_PADE(h, alpha, S, beta, obs, weight, rcens, rcweight)
logLikelihoodMgompertz_PADE(h, alpha, S, beta, obs, weight, rcens, rcweight)
h |
Nuisance parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Inhomogeneity parameter. |
obs |
The observations. |
weight |
The weights of the observations. |
rcens |
Censored observations. |
rcweight |
The weights of the censored observations. |
Loglikelihood for a sample.
logLikelihoodMgompertz_PADEs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
logLikelihoodMgompertz_PADEs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
h |
Nuisance parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity. |
beta |
Inhomogeneity parameter. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
Censored observations. |
rcweight |
Weights of the censored observations. |
scale1 |
Scale for observations. |
scale2 |
Scale for censored observations. |
Loglikelihood for a sample.
logLikelihoodMgompertz_RK(h, alpha, S, beta, obs, weight, rcens, rcweight)
logLikelihoodMgompertz_RK(h, alpha, S, beta, obs, weight, rcens, rcweight)
h |
Step-length. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Parameter of transformation. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
Censored observations. |
rcweight |
Weights of the censored observations. |
Loglikelihood for a sample.
logLikelihoodMgompertz_RKs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
logLikelihoodMgompertz_RKs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
h |
Step-length. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Parameter of transformation. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
Censored observations. |
rcweight |
Weights of the censored observations. |
scale1 |
Scale for observations. |
scale2 |
Scale for censored observations. |
Loglikelihood for a sample.
logLikelihoodMgompertz_UNI(h, alpha, S, beta, obs, weight, rcens, rcweight)
logLikelihoodMgompertz_UNI(h, alpha, S, beta, obs, weight, rcens, rcweight)
h |
Positive parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Parameter of transformation. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
censored observations. |
rcweight |
Weights of the censored observations. |
Loglikelihood for a sample.
logLikelihoodMgompertz_UNIs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
logLikelihoodMgompertz_UNIs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
h |
Positive parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Parameter of transformation. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
Censored observations. |
rcweight |
Weights of the censored observations. |
scale1 |
Scale for observations. |
scale2 |
Scale for censored observations. |
Loglikelihood for a sample.
logLikelihoodMloglogistic_PADE(h, alpha, S, beta, obs, weight, rcens, rcweight)
logLikelihoodMloglogistic_PADE(h, alpha, S, beta, obs, weight, rcens, rcweight)
h |
Nuisance parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Inhomogeneity parameter. |
obs |
The observations. |
weight |
The weights of the observations. |
rcens |
Censored observations. |
rcweight |
The weights of the censored observations. |
Loglikelihood for a sample.
logLikelihoodMloglogistic_PADEs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
logLikelihoodMloglogistic_PADEs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
h |
Nuisance parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Inhomogeneity parameter. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
Censored observations. |
rcweight |
Weights of the censored observations. |
scale1 |
Scale for observations. |
scale2 |
Scale for censored observations. |
Loglikelihood for a sample.
logLikelihoodMloglogistic_RK(h, alpha, S, beta, obs, weight, rcens, rcweight)
logLikelihoodMloglogistic_RK(h, alpha, S, beta, obs, weight, rcens, rcweight)
h |
Step-length. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Parameters of transformation. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
Censored observations. |
rcweight |
Weights of the censored observations. |
Loglikelihood for a sample.
logLikelihoodMloglogistic_RKs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
logLikelihoodMloglogistic_RKs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
h |
Step-length. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Parameters of transformation. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
Censored observations. |
rcweight |
Weights of the censored observations. |
scale1 |
Scale for observations. |
scale2 |
Scale for censored observations. |
Loglikelihood for a sample.
logLikelihoodMloglogistic_UNI(h, alpha, S, beta, obs, weight, rcens, rcweight)
logLikelihoodMloglogistic_UNI(h, alpha, S, beta, obs, weight, rcens, rcweight)
h |
Positive parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Parameter of transformation. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
censored observations. |
rcweight |
Weights of the censored observations. |
Loglikelihood for a sample.
logLikelihoodMloglogistic_UNIs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
logLikelihoodMloglogistic_UNIs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
h |
Positive parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Parameter of transformation. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
Censored observations. |
rcweight |
Weights of the censored observations. |
scale1 |
Scale for observations. |
scale2 |
Scale for censored observations. |
Loglikelihood for a sample.
logLikelihoodMlognormal_PADE(h, alpha, S, beta, obs, weight, rcens, rcweight)
logLikelihoodMlognormal_PADE(h, alpha, S, beta, obs, weight, rcens, rcweight)
h |
Nuisance parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Inhomogeneity parameter. |
obs |
The observations. |
weight |
The weights of the observations. |
rcens |
Censored observations. |
rcweight |
The weights of the censored observations. |
Loglikelihood for a sample.
logLikelihoodMlognormal_PADEs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
logLikelihoodMlognormal_PADEs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
h |
Nuisance parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Inhomogeneity parameter. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
Censored observations. |
rcweight |
Weights of the censored observations. |
scale1 |
Scale for observations. |
scale2 |
Scale for censored observations. |
Loglikelihood for a sample.
logLikelihoodMlognormal_RK(h, alpha, S, beta, obs, weight, rcens, rcweight)
logLikelihoodMlognormal_RK(h, alpha, S, beta, obs, weight, rcens, rcweight)
h |
Step-length. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Parameter of transformation. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
Censored observations. |
rcweight |
Weights of the censored observations. |
Loglikelihood for a sample.
logLikelihoodMlognormal_RKs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
logLikelihoodMlognormal_RKs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
h |
Step-length. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Parameter of transformation. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
Censored observations. |
rcweight |
Weights of the censored observations. |
scale1 |
Scale for observations. |
scale2 |
Scale for censored observations. |
Loglikelihood for a sample.
logLikelihoodMlognormal_UNI(h, alpha, S, beta, obs, weight, rcens, rcweight)
logLikelihoodMlognormal_UNI(h, alpha, S, beta, obs, weight, rcens, rcweight)
h |
Positive parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Parameter of transformation. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
censored observations. |
rcweight |
Weights of the censored observations. |
Loglikelihood for a sample.
logLikelihoodMlognormal_UNIs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
logLikelihoodMlognormal_UNIs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
h |
Positive parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Parameter of transformation. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
Censored observations. |
rcweight |
Weights of the censored observations. |
scale1 |
Scale for observations. |
scale2 |
Scale for censored observations. |
Loglikelihood for a sample.
logLikelihoodMpareto_PADE(h, alpha, S, beta, obs, weight, rcens, rcweight)
logLikelihoodMpareto_PADE(h, alpha, S, beta, obs, weight, rcens, rcweight)
h |
Nuisance parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Inhomogeneity parameter. |
obs |
The observations. |
weight |
The weights of the observations. |
rcens |
Censored observations. |
rcweight |
The weights of the censored observations. |
Loglikelihood for a sample.
logLikelihoodMpareto_PADEs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
logLikelihoodMpareto_PADEs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
h |
Nuisance parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Inhomogeneity parameter. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
Censored observations. |
rcweight |
Weights of the censored observations. |
scale1 |
Scale for observations. |
scale2 |
Scale for censored observations. |
Loglikelihood for a sample.
logLikelihoodMpareto_RK(h, alpha, S, beta, obs, weight, rcens, rcweight)
logLikelihoodMpareto_RK(h, alpha, S, beta, obs, weight, rcens, rcweight)
h |
Step-length. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Parameter of transformation. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
Censored observations. |
rcweight |
Weights of the censored observations. |
Loglikelihood for a sample.
logLikelihoodMpareto_RKs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
logLikelihoodMpareto_RKs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
h |
Step-length. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Parameter of transformation. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
Censored observations. |
rcweight |
Weights of the censored observations. |
scale1 |
Scale for observations. |
scale2 |
Scale for censored observations. |
Loglikelihood for a sample.
logLikelihoodMpareto_UNI(h, alpha, S, beta, obs, weight, rcens, rcweight)
logLikelihoodMpareto_UNI(h, alpha, S, beta, obs, weight, rcens, rcweight)
h |
Positive parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Parameter of transformation. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
censored observations. |
rcweight |
Weights of the censored observations. |
Loglikelihood for a sample.
logLikelihoodMpareto_UNIs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
logLikelihoodMpareto_UNIs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
h |
Positive parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Parameter of transformation. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
Censored observations. |
rcweight |
Weights of the censored observations. |
scale1 |
Scale for observations. |
scale2 |
Scale for censored observations. |
Loglikelihood for a sample.
logLikelihoodMweibull_PADE(h, alpha, S, beta, obs, weight, rcens, rcweight)
logLikelihoodMweibull_PADE(h, alpha, S, beta, obs, weight, rcens, rcweight)
h |
Nuisance parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Inhomogeneity parameter. |
obs |
The observations. |
weight |
The weights of the observations. |
rcens |
Censored observations. |
rcweight |
The weights of the censored observations. |
Loglikelihood for a sample.
logLikelihoodMweibull_PADEs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
logLikelihoodMweibull_PADEs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
h |
Nuisance parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Inhomogeneity parameter. |
obs |
The observations. |
weight |
The weights of the observations. |
rcens |
Censored observations. |
rcweight |
The weights of the censored observations. |
scale1 |
Scale for observations. |
scale2 |
Scale for censored observations. |
Loglikelihood for a sample.
logLikelihoodMweibull_RK(h, alpha, S, beta, obs, weight, rcens, rcweight)
logLikelihoodMweibull_RK(h, alpha, S, beta, obs, weight, rcens, rcweight)
h |
Step-length. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Parameter of transformation. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
Censored observations. |
rcweight |
Weights of the censored observations. |
Loglikelihood for a sample.
logLikelihoodMweibull_RKs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
logLikelihoodMweibull_RKs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
h |
Step-length. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Parameter of transformation. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
Censored observations. |
rcweight |
Weights of the censored observations. |
scale1 |
Scale for observations. |
scale2 |
Scale for censored observations. |
Loglikelihood for a sample.
logLikelihoodMweibull_UNI(h, alpha, S, beta, obs, weight, rcens, rcweight)
logLikelihoodMweibull_UNI(h, alpha, S, beta, obs, weight, rcens, rcweight)
h |
Positive parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Parameter of transformation. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
censored observations. |
rcweight |
Weights of the censored observations. |
Loglikelihood for a sample.
logLikelihoodMweibull_UNIs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
logLikelihoodMweibull_UNIs( h, alpha, S, beta, obs, weight, rcens, rcweight, scale1, scale2 )
h |
Positive parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Parameter of transformation. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
Censored observations. |
rcweight |
Weights of the censored observations. |
scale1 |
Scale for observations. |
scale2 |
Scale for censored observations. |
Loglikelihood for PH-MoE
logLikelihoodPH_MoE(alpha1, alpha2, S, obs, weight, rcens, rcweight)
logLikelihoodPH_MoE(alpha1, alpha2, S, obs, weight, rcens, rcweight)
alpha1 |
Initial probabilities for non-censored data. |
alpha2 |
Initial probabilities for censored data. |
S |
Sub-intensity matrix. |
obs |
The observations. |
weight |
The weights of the observations. |
rcens |
Censored observations. |
rcweight |
The weights of the censored observations. |
Loglikelihood for a sample.
logLikelihoodPH_PADE(h, alpha, S, obs, weight, rcens, rcweight)
logLikelihoodPH_PADE(h, alpha, S, obs, weight, rcens, rcweight)
h |
Nuisance parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
obs |
The observations. |
weight |
The weights of the observations. |
rcens |
Censored observations. |
rcweight |
The weights of the censored observations. |
Loglikelihood for a sample.
logLikelihoodPH_PADEs( h, alpha, S, obs, weight, rcens, rcweight, scale1, scale2 )
logLikelihoodPH_PADEs( h, alpha, S, obs, weight, rcens, rcweight, scale1, scale2 )
h |
Nuisance parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
obs |
The observations. |
weight |
The weights of the observations. |
rcens |
Censored observations. |
rcweight |
The weights of the censored observations. |
scale1 |
Scale for observations. |
scale2 |
Scale for censored observations. |
Loglikelihood for a sample.
logLikelihoodPH_RK(h, alpha, S, obs, weight, rcens, rcweight)
logLikelihoodPH_RK(h, alpha, S, obs, weight, rcens, rcweight)
h |
Step-length. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
Censored observations. |
rcweight |
Weights of the censored observations. |
Loglikelihood for a sample.
logLikelihoodPH_RKs(h, alpha, S, obs, weight, rcens, rcweight, scale1, scale2)
logLikelihoodPH_RKs(h, alpha, S, obs, weight, rcens, rcweight, scale1, scale2)
h |
Step-length. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
Censored observations. |
rcweight |
Weights of the censored observations. |
scale1 |
Scale for observations. |
scale2 |
Scale for censored observations. |
Loglikelihood for a sample.
logLikelihoodPH_UNI(h, alpha, S, obs, weight, rcens, rcweight)
logLikelihoodPH_UNI(h, alpha, S, obs, weight, rcens, rcweight)
h |
Positive parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
Censored observations. |
rcweight |
Weights of the censored observations. |
Loglikelihood for a sample.
logLikelihoodPH_UNIs(h, alpha, S, obs, weight, rcens, rcweight, scale1, scale2)
logLikelihoodPH_UNIs(h, alpha, S, obs, weight, rcens, rcweight, scale1, scale2)
h |
Positive parameter. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
obs |
The observations. |
weight |
Weights of the observations. |
rcens |
Censored observations. |
rcweight |
Weights of the censored observations. |
scale1 |
Scale for observations. |
scale2 |
Scale for censored observations. |
Methods are available for objects of class ph.
LRT(x, y, ...)
LRT(x, y, ...)
x , y
|
Objects of the model class. |
... |
Further parameters to be passed on. |
A likelihood ratio test result.
LRT method for ph class
## S4 method for signature 'ph,ph' LRT(x, y)
## S4 method for signature 'ph,ph' LRT(x, y)
x , y
|
Objects of class ph. |
LRT between the models.
Computes exp(Sx) via series representation
m_exp_sum(x, n, pow_vector, a)
m_exp_sum(x, n, pow_vector, a)
x |
A number. |
n |
An integer. |
pow_vector |
A vector. |
a |
A number. |
Methods are available for objects of multivariate classes.
marginal(x, ...)
marginal(x, ...)
x |
An object of the model class. |
... |
Further parameters to be passed on. |
Marginal of the matrix distribution.
Marginal conditional expectations
marginal_expectation(rew, pos, N, alpha, S, obs, weight)
marginal_expectation(rew, pos, N, alpha, S, obs, weight)
rew |
Column of the reward matrix corresponding to its marginal. |
pos |
Vector that indicates which state is associated to a positive reward. |
N |
Uniformization parameter. |
alpha |
Marginal initial distribution vector. |
S |
Marginal sub-intensity matrix. |
obs |
Marginal observations. |
weight |
Marginal weights. |
A vector with the expected time spent in each state by the marginal, conditional on the observations.
Marginal method for bivdph class
## S4 method for signature 'bivdph' marginal(x, mar = 1)
## S4 method for signature 'bivdph' marginal(x, mar = 1)
x |
An object of class bivdph. |
mar |
Indicator of which marginal. |
An object of the of class dph.
obj <- bivdph(dimensions = c(3, 3)) marginal(obj, 1)
obj <- bivdph(dimensions = c(3, 3)) marginal(obj, 1)
Marginal method for biviph class
## S4 method for signature 'biviph' marginal(x, mar = 1)
## S4 method for signature 'biviph' marginal(x, mar = 1)
x |
An object of class biviph. |
mar |
Indicator of which marginal. |
An object of the of class iph.
under_bivph <- bivph(dimensions = c(3, 3)) obj <- biviph(under_bivph, gfun = c("weibull", "pareto"), gfun_pars = list(c(2), c(3))) marginal(obj, 1)
under_bivph <- bivph(dimensions = c(3, 3)) obj <- biviph(under_bivph, gfun = c("weibull", "pareto"), gfun_pars = list(c(2), c(3))) marginal(obj, 1)
Marginal method for bivph class
## S4 method for signature 'bivph' marginal(x, mar = 1)
## S4 method for signature 'bivph' marginal(x, mar = 1)
x |
An object of class bivph. |
mar |
Indicator of which marginal. |
An object of the of class ph.
obj <- bivph(dimensions = c(3, 3)) marginal(obj, 1)
obj <- bivph(dimensions = c(3, 3)) marginal(obj, 1)
Marginal method for mdph class
## S4 method for signature 'mdph' marginal(x, mar = 1)
## S4 method for signature 'mdph' marginal(x, mar = 1)
x |
An object of class mdph. |
mar |
Indicator of which marginal. |
An object of the of class dph.
obj <- mdph(structure = c("general", "general")) marginal(obj, 1)
obj <- mdph(structure = c("general", "general")) marginal(obj, 1)
Marginal method for multivariate inhomogeneous phase-type distributions
## S4 method for signature 'miph' marginal(x, mar = 1)
## S4 method for signature 'miph' marginal(x, mar = 1)
x |
An object of class miph. |
mar |
Indicator of which marginal. |
An object of the of class iph.
under_mph <- mph(structure = c("general", "general")) obj <- miph(under_mph, gfun = c("weibull", "pareto"), gfun_pars = list(c(2), c(3))) marginal(obj, 1)
under_mph <- mph(structure = c("general", "general")) obj <- miph(under_mph, gfun = c("weibull", "pareto"), gfun_pars = list(c(2), c(3))) marginal(obj, 1)
Marginal method for multivariate phase-type distributions
## S4 method for signature 'mph' marginal(x, mar = 1)
## S4 method for signature 'mph' marginal(x, mar = 1)
x |
An object of class mph. |
mar |
Indicator of which marginal. |
An object of the of class ph.
obj <- mph(structure = c("general", "general")) marginal(obj, 1)
obj <- mph(structure = c("general", "general")) marginal(obj, 1)
Marginal method for MPHstar class
## S4 method for signature 'MPHstar' marginal(x, mar = 1)
## S4 method for signature 'MPHstar' marginal(x, mar = 1)
x |
An object of class MPHstar. |
mar |
Indicator of which marginal. |
An object of the of class ph.
obj <- MPHstar(structure = "general") marginal(obj, 1)
obj <- MPHstar(structure = "general") marginal(obj, 1)
MATLAB's built-in algorithm for matrix exponential - Pade approximation.
matrix_exponential(A)
matrix_exponential(A)
A |
A matrix. |
exp(A).
Inverse of a matrix
matrix_inverse(A)
matrix_inverse(A)
A |
A matrix. |
Inverse of A.
Computes A^n
matrix_power(n, A)
matrix_power(n, A)
n |
An integer. |
A |
A matrix. |
A^n.
Product of two matrices
matrix_product(A1, A2)
matrix_product(A1, A2)
A1 |
A matrix. |
A2 |
A matrix. |
Computes A1 * A2.
Creates the matrix (A1, B1 ; 0, A2)
matrix_vanloan(A1, A2, B1)
matrix_vanloan(A1, A2, B1)
A1 |
Matrix. |
A2 |
Matrix. |
B1 |
Matrix. |
Computes (A1, B1 ; 0, A2).
Maximum diagonal element of a matrix
max_diagonal(A)
max_diagonal(A)
A |
Matrix. |
The maximum value in the diagonal.
Methods are available for objects of class ph.
maximum(x1, x2, ...)
maximum(x1, x2, ...)
x1 |
An object of the model class. |
x2 |
An object of the model class. |
... |
Further parameters to be passed on. |
An object of the model class.
Maximum method for discrete phase-type distributions
## S4 method for signature 'dph,dph' maximum(x1, x2)
## S4 method for signature 'dph,dph' maximum(x1, x2)
x1 |
An object of class dph. |
x2 |
An object of class dph. |
An object of class dph.
dph1 <- dph(structure = "general", dimension = 3) dph2 <- dph(structure = "general", dimension = 5) dph_max <- maximum(dph1, dph2) dph_max
dph1 <- dph(structure = "general", dimension = 3) dph2 <- dph(structure = "general", dimension = 5) dph_max <- maximum(dph1, dph2) dph_max
Maximum method for inhomogeneous phase-type distributions
## S4 method for signature 'iph,iph' maximum(x1, x2)
## S4 method for signature 'iph,iph' maximum(x1, x2)
x1 |
An object of class iph. |
x2 |
An object of class iph. |
An object of class iph.
iph1 <- iph(ph(structure = "general", dimension = 3), gfun = "weibull", gfun_pars = 2) iph2 <- iph(ph(structure = "gcoxian", dimension = 5), gfun = "weibull", gfun_pars = 2) iph_min <- maximum(iph1, iph2) iph_min
iph1 <- iph(ph(structure = "general", dimension = 3), gfun = "weibull", gfun_pars = 2) iph2 <- iph(ph(structure = "gcoxian", dimension = 5), gfun = "weibull", gfun_pars = 2) iph_min <- maximum(iph1, iph2) iph_min
Maximum method for phase-type distributions
## S4 method for signature 'ph,ph' maximum(x1, x2)
## S4 method for signature 'ph,ph' maximum(x1, x2)
x1 |
An object of class ph. |
x2 |
An object of class ph. |
An object of class ph.
ph1 <- ph(structure = "general", dimension = 3) ph2 <- ph(structure = "gcoxian", dimension = 5) ph_max <- maximum(ph1, ph2) ph_max
ph1 <- ph(structure = "general", dimension = 3) ph2 <- ph(structure = "gcoxian", dimension = 5) ph_max <- maximum(ph1, ph2) ph_max
Constructor function for multivariate discrete phase-type distributions
mdph(alpha = NULL, S = NULL, structure = NULL, dimension = 3, variables = NULL)
mdph(alpha = NULL, S = NULL, structure = NULL, dimension = 3, variables = NULL)
alpha |
A probability vector. |
S |
A list of sub-transition matrices. |
structure |
A vector of valid ph structures. |
dimension |
The dimension of the dph structure (if provided). |
variables |
The dimension of the multivariate discrete phase-type. |
An object of class mdph.
mdph(structure = c("general", "general"), dimension = 5)
mdph(structure = c("general", "general"), dimension = 5)
Class of objects for multivariate discrete phase-type distributions.
Class object.
name
Name of the discrete phase-type distribution.
pars
A list comprising of the parameters.
fit
A list containing estimation information.
Computes the density of multivariate discrete phase-type distribution with
parameters alpha
and S
at x
.
mdphdensity(x, alpha, S_list)
mdphdensity(x, alpha, S_list)
x |
Matrix of positive integer values. |
alpha |
Initial probabilities. |
S_list |
List of marginal sub-transition matrices. |
The density at x
.
Mean method for bivdph class
## S4 method for signature 'bivdph' mean(x)
## S4 method for signature 'bivdph' mean(x)
x |
An object of class bivdph. |
The mean of the bivariate discrete phase-type distribution.
obj <- bivdph(dimensions = c(3, 3)) mean(obj)
obj <- bivdph(dimensions = c(3, 3)) mean(obj)
Mean Method for bivph class
## S4 method for signature 'bivph' mean(x)
## S4 method for signature 'bivph' mean(x)
x |
An object of class bivph. |
The mean of the bivariate phase-type distribution.
obj <- bivph(dimensions = c(3, 3)) mean(obj)
obj <- bivph(dimensions = c(3, 3)) mean(obj)
Mean method for discrete phase-type distributions
## S4 method for signature 'dph' mean(x)
## S4 method for signature 'dph' mean(x)
x |
An object of class dph. |
The raw first moment of the dph object.
set.seed(123) obj <- dph(structure = "general", dimension = 3) mean(obj)
set.seed(123) obj <- dph(structure = "general", dimension = 3) mean(obj)
Mean method for multivariate discrete phase-type distributions
## S4 method for signature 'mdph' mean(x)
## S4 method for signature 'mdph' mean(x)
x |
An object of class mdph. |
The mean of the multivariate discrete phase-type distribution.
obj <- mdph(structure = c("general", "general")) mean(obj)
obj <- mdph(structure = c("general", "general")) mean(obj)
Mean method for multivariate phase-type distributions
## S4 method for signature 'mph' mean(x)
## S4 method for signature 'mph' mean(x)
x |
An object of class mph. |
The mean of the multivariate phase-type distribution.
obj <- mph(structure = c("general", "general")) mean(obj)
obj <- mph(structure = c("general", "general")) mean(obj)
Mean method for MPHstar class
## S4 method for signature 'MPHstar' mean(x)
## S4 method for signature 'MPHstar' mean(x)
x |
An object of class MPHstar. |
The mean of MPHstar distribution.
obj <- MPHstar(structure = "general") mean(obj)
obj <- MPHstar(structure = "general") mean(obj)
Mean method for phase-type distributions
## S4 method for signature 'ph' mean(x)
## S4 method for signature 'ph' mean(x)
x |
An object of class ph. |
The raw first moment of the ph (or underlying ph) object.
set.seed(123) obj <- ph(structure = "general", dimension = 3) mean(obj)
set.seed(123) obj <- ph(structure = "general", dimension = 3) mean(obj)
Merges the matrices S11, S12 and S22 into a sub-intensity matrix
merge_matrices(S11, S12, S22)
merge_matrices(S11, S12, S22)
S11 |
A sub-intensity matrix. |
S12 |
A matrix. |
S22 |
A sub-intensity matrix. |
A sub-intensity matrix.
Computes the cdf (tail) of a matrix-GEV distribution with parameters
alpha
, S
and beta
at x
.
mgevcdf(x, alpha, S, beta, lower_tail = TRUE)
mgevcdf(x, alpha, S, beta, lower_tail = TRUE)
x |
Non-negative value. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Transformation parameters. |
lower_tail |
Cdf or tail. |
The cdf (tail) at x
.
Computes the density of a matrix-GEV distribution with parameters
alpha
, S
and beta
at x
.
Does not allow for atoms in zero.
mgevden(x, alpha, S, beta)
mgevden(x, alpha, S, beta)
x |
Non-negative value. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Transformation parameters. |
The density at x
.
Methods are available for objects of class ph.
mgf(x, ...)
mgf(x, ...)
x |
An object of the model class. |
... |
Further parameters to be passed on. |
Mgf of the matrix distribution.
Mgf method for bivph class
## S4 method for signature 'bivph' mgf(x, r)
## S4 method for signature 'bivph' mgf(x, r)
x |
An object of class mph. |
r |
A matrix of real values. |
A vector containing the corresponding mgf evaluations.
set.seed(123) obj <- bivph(dimensions = c(3, 3)) mgf(obj, matrix(c(0.5, 0.1), ncol = 2))
set.seed(123) obj <- bivph(dimensions = c(3, 3)) mgf(obj, matrix(c(0.5, 0.1), ncol = 2))
Mgf method for multivariate phase-type distributions
## S4 method for signature 'mph' mgf(x, r)
## S4 method for signature 'mph' mgf(x, r)
x |
An object of class mph. |
r |
A matrix of real values. |
A vector containing the corresponding mgf evaluations.
set.seed(124) obj <- mph(structure = c("general", "general")) mgf(obj, matrix(c(0.5, 0.3), ncol = 2))
set.seed(124) obj <- mph(structure = c("general", "general")) mgf(obj, matrix(c(0.5, 0.3), ncol = 2))
Mgf method for phase-type distributions
## S4 method for signature 'ph' mgf(x, r)
## S4 method for signature 'ph' mgf(x, r)
x |
An object of class ph. |
r |
A vector of real values. |
The mgf of the ph (or underlying ph) object at the given locations.
set.seed(123) obj <- ph(structure = "general", dimension = 3) mgf(obj, 0.4)
set.seed(123) obj <- ph(structure = "general", dimension = 3) mgf(obj, 0.4)
Computes the cdf (tail) of a matrix-Gompertz distribution with parameters
alpha
, S
and beta
at x
.
mgompertzcdf(x, alpha, S, beta, lower_tail = TRUE)
mgompertzcdf(x, alpha, S, beta, lower_tail = TRUE)
x |
Non-negative value. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Shape parameter. |
lower_tail |
Cdf or tail. |
The cdf (tail) at x
.
Computes the density of a matrix-Gompertz distribution with parameters
alpha
, S
and beta
at x
.
mgompertzden(x, alpha, S, beta)
mgompertzden(x, alpha, S, beta)
x |
Non-negative value. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Shape parameter. |
The density at x
.
Methods are available for objects of class ph.
minimum(x1, x2, ...)
minimum(x1, x2, ...)
x1 |
An object of the model class. |
x2 |
An object of the model class. |
... |
Further parameters to be passed on. |
An object of the model class.
Minimum method for discrete phase-type distributions
## S4 method for signature 'dph,dph' minimum(x1, x2)
## S4 method for signature 'dph,dph' minimum(x1, x2)
x1 |
An object of class dph. |
x2 |
An object of class dph. |
An object of class dph.
dph1 <- dph(structure = "general", dimension = 3) dph2 <- dph(structure = "general", dimension = 5) dph_min <- minimum(dph1, dph2) dph_min
dph1 <- dph(structure = "general", dimension = 3) dph2 <- dph(structure = "general", dimension = 5) dph_min <- minimum(dph1, dph2) dph_min
Minimum method for inhomogeneous phase-type distributions
## S4 method for signature 'iph,iph' minimum(x1, x2)
## S4 method for signature 'iph,iph' minimum(x1, x2)
x1 |
An object of class iph. |
x2 |
An object of class iph. |
An object of class iph.
iph1 <- iph(ph(structure = "general", dimension = 3), gfun = "weibull", gfun_pars = 2) iph2 <- iph(ph(structure = "gcoxian", dimension = 5), gfun = "weibull", gfun_pars = 2) iph_min <- minimum(iph1, iph2) iph_min
iph1 <- iph(ph(structure = "general", dimension = 3), gfun = "weibull", gfun_pars = 2) iph2 <- iph(ph(structure = "gcoxian", dimension = 5), gfun = "weibull", gfun_pars = 2) iph_min <- minimum(iph1, iph2) iph_min
Minimum method for phase-type distributions
## S4 method for signature 'ph,ph' minimum(x1, x2)
## S4 method for signature 'ph,ph' minimum(x1, x2)
x1 |
An object of class ph. |
x2 |
An object of class ph. |
An object of class ph.
ph1 <- ph(structure = "general", dimension = 3) ph2 <- ph(structure = "gcoxian", dimension = 5) ph_min <- minimum(ph1, ph2) ph_min
ph1 <- ph(structure = "general", dimension = 3) ph2 <- ph(structure = "gcoxian", dimension = 5) ph_min <- minimum(ph1, ph2) ph_min
Constructor function for multivariate inhomogeneous phase-type distributions
miph( mph = NULL, gfun = NULL, gfun_pars = NULL, alpha = NULL, S = NULL, structure = NULL, dimension = 3, variables = NULL, scale = 1 )
miph( mph = NULL, gfun = NULL, gfun_pars = NULL, alpha = NULL, S = NULL, structure = NULL, dimension = 3, variables = NULL, scale = 1 )
mph |
An object of class mph. |
gfun |
Vector of inhomogeneity transforms. |
gfun_pars |
List of parameters for the inhomogeneity functions. |
alpha |
A probability vector. |
S |
A list of sub-intensity matrices. |
structure |
A vector of valid ph structures. |
dimension |
The dimension of the ph structure (if provided). |
variables |
Number of marginals. |
scale |
Scale. |
An object of class iph.
under_mph <- mph(structure = c("gcoxian", "general"), dimension = 4) miph(under_mph, gfun = c("weibull", "pareto"), gfun_pars = list(c(2), c(3)))
under_mph <- mph(structure = c("gcoxian", "general"), dimension = 4) miph(under_mph, gfun = c("weibull", "pareto"), gfun_pars = list(c(2), c(3)))
Class of objects for multivariate inhomogeneous phase-type distributions.
Class object.
name
Name of the phase type distribution.
gfun
A list comprising of the parameters.
scale
Scale.
Methods are available for objects of classes ph and dph.
mixture(x1, x2, ...)
mixture(x1, x2, ...)
x1 |
An object of the model class. |
x2 |
An object of the model class. |
... |
Further parameters to be passed on. |
An object of the model class.
Mixture method for phase-type distributions
## S4 method for signature 'dph,dph' mixture(x1, x2, prob)
## S4 method for signature 'dph,dph' mixture(x1, x2, prob)
x1 |
An object of class dph. |
x2 |
An object of class dph. |
prob |
Probability for first object. |
An object of class dph.
dph1 <- dph(structure = "general", dimension = 3) dph2 <- dph(structure = "general", dimension = 5) dph_mix <- mixture(dph1, dph2, 0.5) dph_mix
dph1 <- dph(structure = "general", dimension = 3) dph2 <- dph(structure = "general", dimension = 5) dph_mix <- mixture(dph1, dph2, 0.5) dph_mix
Mixture method for phase-type distributions
## S4 method for signature 'ph,ph' mixture(x1, x2, prob)
## S4 method for signature 'ph,ph' mixture(x1, x2, prob)
x1 |
An object of class ph. |
x2 |
An object of class ph. |
prob |
Probability for first object. |
An object of class ph.
ph1 <- ph(structure = "general", dimension = 3) ph2 <- ph(structure = "gcoxian", dimension = 5) ph_mix <- mixture(ph1, ph2, 0.5) ph_mix
ph1 <- ph(structure = "general", dimension = 3) ph2 <- ph(structure = "gcoxian", dimension = 5) ph_mix <- mixture(ph1, ph2, 0.5) ph_mix
Computes the cdf (tail) of a matrix-loglogistic distribution with parameters
alpha
, S
and beta
at x
.
mloglogisticcdf(x, alpha, S, beta, lower_tail = TRUE)
mloglogisticcdf(x, alpha, S, beta, lower_tail = TRUE)
x |
Non-negative value. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Transformation parameters. |
lower_tail |
Cdf or tail. |
The cdf (tail) at x
.
Computes the density of a matrix-loglogistic distribution with parameters
alpha
, S
and beta
at x
.
mloglogisticden(x, alpha, S, beta)
mloglogisticden(x, alpha, S, beta)
x |
Non-negative value. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Transformation parameters. |
The density at x
.
Computes the cdf (tail) of a matrix-lognormal distribution with parameters
alpha
, S
and beta
at x
.
mlognormalcdf(x, alpha, S, beta, lower_tail = TRUE)
mlognormalcdf(x, alpha, S, beta, lower_tail = TRUE)
x |
Non-negative value. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Shape parameter. |
lower_tail |
Cdf or tail. |
The cdf (tail) at x
.
Computes the density of a matrix-lognormal distribution with parameters
alpha
, S
and beta
at x
.
mlognormalden(x, alpha, S, beta)
mlognormalden(x, alpha, S, beta)
x |
Non-negative value. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Shape parameter. |
The density at x
.
Methods are available for objects of class ph
MoE(x, y, ...)
MoE(x, y, ...)
x |
An object of the model class. |
y |
A vector of data. |
... |
Further parameters to be passed on. |
An object of the fitted model class.
MoE method for bivdph Class
## S4 method for signature 'bivdph' MoE( x, formula, y, data, alpha_vecs = NULL, weight = numeric(0), stepsEM = 1000, every = 10, rand_init = TRUE )
## S4 method for signature 'bivdph' MoE( x, formula, y, data, alpha_vecs = NULL, weight = numeric(0), stepsEM = 1000, every = 10, rand_init = TRUE )
x |
An object of class bivdph. |
formula |
A regression formula. |
y |
A matrix of observations. |
data |
A data frame of covariates. |
alpha_vecs |
Matrix of initial probabilities. |
weight |
Vector of weights. |
stepsEM |
Number of EM steps to be performed. |
every |
Number of iterations between likelihood display updates. |
rand_init |
Random initiation in the R-step. |
An object of class sph.
x <- bivdph(dimensions = c(3, 3)) n <- 100 responses <- cbind(rpois(n, 3) + 1, rbinom(n, 5, 0.5)) covariates <- data.frame(age = sample(18:65, n, replace = TRUE) / 100, income = runif(n, 0, 0.99)) f <- responses ~ age + income MoE(x = x, formula = f, y = responses, data = covariates, stepsEM = 20)
x <- bivdph(dimensions = c(3, 3)) n <- 100 responses <- cbind(rpois(n, 3) + 1, rbinom(n, 5, 0.5)) covariates <- data.frame(age = sample(18:65, n, replace = TRUE) / 100, income = runif(n, 0, 0.99)) f <- responses ~ age + income MoE(x = x, formula = f, y = responses, data = covariates, stepsEM = 20)
MoE method for dph Class
## S4 method for signature 'dph' MoE( x, formula, data, alpha_vecs = NULL, weight = numeric(0), stepsEM = 1000, every = 10, rand_init = TRUE, maxWts = 1000 )
## S4 method for signature 'dph' MoE( x, formula, data, alpha_vecs = NULL, weight = numeric(0), stepsEM = 1000, every = 10, rand_init = TRUE, maxWts = 1000 )
x |
An object of class dph. |
formula |
A regression formula. |
data |
A data frame. |
alpha_vecs |
Matrix of initial probabilities. |
weight |
Vector of weights. |
stepsEM |
Number of EM steps to be performed. |
every |
Number of iterations between likelihood display updates. |
rand_init |
Random initiation in the R-step. |
maxWts |
Maximal number of weights in the nnet function. |
An object of class sph.
x <- dph(structure = "general") n <- 100 responses <- rpois(n, 3) + 1 covariate <- data.frame(age = sample(18:65, n, replace = TRUE) / 100, income = runif(n, 0, 0.99)) f <- responses ~ age + income # regression formula MoE(x = x, formula = f, y = responses, data = covariate, stepsEM = 20)
x <- dph(structure = "general") n <- 100 responses <- rpois(n, 3) + 1 covariate <- data.frame(age = sample(18:65, n, replace = TRUE) / 100, income = runif(n, 0, 0.99)) f <- responses ~ age + income # regression formula MoE(x = x, formula = f, y = responses, data = covariate, stepsEM = 20)
MoE method for mdph Class
## S4 method for signature 'mdph' MoE( x, formula, y, data, alpha_vecs = NULL, weight = numeric(0), stepsEM = 1000, every = 10, rand_init = TRUE, maxWts = 1000 )
## S4 method for signature 'mdph' MoE( x, formula, y, data, alpha_vecs = NULL, weight = numeric(0), stepsEM = 1000, every = 10, rand_init = TRUE, maxWts = 1000 )
x |
An object of class mdph. |
formula |
A regression formula. |
y |
A matrix of observations. |
data |
A data frame of covariates. |
alpha_vecs |
Matrix of initial probabilities. |
weight |
Vector of weights. |
stepsEM |
Number of EM steps to be performed. |
every |
Number of iterations between likelihood display updates. |
rand_init |
Random initiation in the R-step. |
maxWts |
Maximal number of weights in the nnet function. |
An object of class sph.
x <- mdph(structure = c("general", "general")) n <- 100 responses <- cbind(rpois(n, 3) + 1, rbinom(n, 5, 0.5)) covariates <- data.frame(age = sample(18:65, n, replace = TRUE) / 100, income = runif(n, 0, 0.99)) f <- responses ~ age + income MoE(x = x, formula = f, y = responses, data = covariates, stepsEM = 20)
x <- mdph(structure = c("general", "general")) n <- 100 responses <- cbind(rpois(n, 3) + 1, rbinom(n, 5, 0.5)) covariates <- data.frame(age = sample(18:65, n, replace = TRUE) / 100, income = runif(n, 0, 0.99)) f <- responses ~ age + income MoE(x = x, formula = f, y = responses, data = covariates, stepsEM = 20)
Fit method for mph/miph class, using mixture-of-experts regression
## S4 method for signature 'mph' MoE( x, formula, y, data, alpha_mat = NULL, delta = numeric(0), stepsEM = 1000, r = 1, maxit = 100, reltol = 1e-08, rand_init = T )
## S4 method for signature 'mph' MoE( x, formula, y, data, alpha_mat = NULL, delta = numeric(0), stepsEM = 1000, r = 1, maxit = 100, reltol = 1e-08, rand_init = T )
x |
An object of class mph. |
formula |
a regression formula. |
y |
A matrix of observations. |
data |
A data frame of covariates (they need to be scaled for the regression). |
alpha_mat |
Matrix with initial distribution vectors for each row of observations. |
delta |
Matrix with right-censoring indicators (1 uncensored, 0 right censored). |
stepsEM |
Number of EM steps to be performed. |
r |
Sub-sampling parameter, defaults to 1 (not supported for this method). |
maxit |
Maximum number of iterations when optimizing the g function (inhomogeneous likelihood). |
reltol |
Relative tolerance when optimizing g function. |
rand_init |
Random initiation in the R-step of the EM algorithm. |
under_mph <- mph(structure = c("general", "general"), dimension = 3) x <- miph(under_mph, gfun = c("weibull", "weibull"), gfun_pars = list(c(2), c(3))) n <- 100 responses <- cbind(rexp(n), rweibull(n, 2, 3)) covariates <- data.frame(age = sample(18:65, n, replace = TRUE) / 100, income = runif(n, 0, 0.99)) f <- responses ~ age + income MoE(x = x, formula = f, y = responses, data = covariates, stepsEM = 20)
under_mph <- mph(structure = c("general", "general"), dimension = 3) x <- miph(under_mph, gfun = c("weibull", "weibull"), gfun_pars = list(c(2), c(3))) n <- 100 responses <- cbind(rexp(n), rweibull(n, 2, 3)) covariates <- data.frame(age = sample(18:65, n, replace = TRUE) / 100, income = runif(n, 0, 0.99)) f <- responses ~ age + income MoE(x = x, formula = f, y = responses, data = covariates, stepsEM = 20)
MoE method for ph Class
## S4 method for signature 'ph' MoE( x, formula, data, inhom = NULL, alpha_vecs = NULL, weight = numeric(0), delta = numeric(0), stepsEM = 1000, optim_method = "BFGS", maxit = 50, reltol = 1e-08, every = 10, rand_init = TRUE )
## S4 method for signature 'ph' MoE( x, formula, data, inhom = NULL, alpha_vecs = NULL, weight = numeric(0), delta = numeric(0), stepsEM = 1000, optim_method = "BFGS", maxit = 50, reltol = 1e-08, every = 10, rand_init = TRUE )
x |
An object of class ph. |
formula |
A regression formula. |
data |
A data frame. |
inhom |
A list with the inhomogeneity functions. |
alpha_vecs |
Matrix of initial probabilities.s |
weight |
Vector of weights. |
delta |
Right-censoring indicator. |
stepsEM |
Number of EM steps to be performed. |
optim_method |
Method to use in gradient optimization. |
maxit |
Maximum number of iterations when optimizing g function. |
reltol |
Relative tolerance when optimizing g function. |
every |
Number of iterations between likelihood display updates. |
rand_init |
Random initiation in the R-step. |
An object of class sph.
x <- iph(ph(structure = "general"), gfun = "weibull") n <- 100 responses <- rweibull(n, 2, 3) covariate <- data.frame(age = sample(18:65, n, replace = TRUE) / 100, income = runif(n, 0, 0.99)) f <- responses ~ age + income # regression formula MoE(x = x, formula = f, y = responses, data = covariate, stepsEM = 20)
x <- iph(ph(structure = "general"), gfun = "weibull") n <- 100 responses <- rweibull(n, 2, 3) covariate <- data.frame(age = sample(18:65, n, replace = TRUE) / 100, income = runif(n, 0, 0.99)) f <- responses ~ age + income # regression formula MoE(x = x, formula = f, y = responses, data = covariate, stepsEM = 20)
Methods are available for objects of class ph.
moment(x, ...)
moment(x, ...)
x |
An object of the model class. |
... |
Further parameters to be passed on. |
Moment of the matrix distribution.
Moment method for bivdph class
## S4 method for signature 'bivdph' moment(x, k = c(1, 1))
## S4 method for signature 'bivdph' moment(x, k = c(1, 1))
x |
An object of class bivdph. |
k |
A vector with the location. |
An real value.
obj <- bivdph(dimensions = c(3, 3)) moment(obj, c(1, 1))
obj <- bivdph(dimensions = c(3, 3)) moment(obj, c(1, 1))
Moment method for bivph class
## S4 method for signature 'bivph' moment(x, k = c(1, 1))
## S4 method for signature 'bivph' moment(x, k = c(1, 1))
x |
An object of class bivph. |
k |
A vector with the location. |
An real value.
obj <- bivph(dimensions = c(3, 3)) moment(obj, c(1, 1))
obj <- bivph(dimensions = c(3, 3)) moment(obj, c(1, 1))
Moment method for discrete phase-type distributions
## S4 method for signature 'dph' moment(x, k = 1)
## S4 method for signature 'dph' moment(x, k = 1)
x |
An object of class dph. |
k |
A positive integer (moment order). |
The factional moment of the dph object.
set.seed(123) obj <- dph(structure = "general", dimension = 3) moment(obj, 2)
set.seed(123) obj <- dph(structure = "general", dimension = 3) moment(obj, 2)
Moment method for multivariate discrete phase-type distributions
## S4 method for signature 'mdph' moment(x, k)
## S4 method for signature 'mdph' moment(x, k)
x |
An object of class mdph. |
k |
A vector of positive integer values. |
The corresponding joint factorial moment evaluation.
obj <- mdph(structure = c("general", "general")) moment(obj, c(2, 1))
obj <- mdph(structure = c("general", "general")) moment(obj, c(2, 1))
Moment method for multivariate phase-type distributions
## S4 method for signature 'mph' moment(x, k)
## S4 method for signature 'mph' moment(x, k)
x |
An object of class mph. |
k |
A vector of non-negative integer values. |
The corresponding joint moment evaluation.
obj <- mph(structure = c("general", "general")) moment(obj, c(2, 1))
obj <- mph(structure = c("general", "general")) moment(obj, c(2, 1))
Moment method for phase-type distributions
## S4 method for signature 'ph' moment(x, k = 1)
## S4 method for signature 'ph' moment(x, k = 1)
x |
An object of class ph. |
k |
A positive integer (moment order). |
The raw moment of the ph (or underlying ph) object.
set.seed(123) obj <- ph(structure = "general", dimension = 3) moment(obj, 2)
set.seed(123) obj <- ph(structure = "general", dimension = 3) moment(obj, 2)
Computes the cdf (tail) of a matrix-Pareto distribution with parameters
alpha
, S
and beta
at x
.
mparetocdf(x, alpha, S, beta, lower_tail = TRUE)
mparetocdf(x, alpha, S, beta, lower_tail = TRUE)
x |
Non-negative value. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Scale parameter. |
lower_tail |
Cdf or tail. |
The cdf (tail) at x
.
Computes the density of a matrix-Pareto distribution with parameters
alpha
, S
and beta
at x
.
mparetoden(x, alpha, S, beta)
mparetoden(x, alpha, S, beta)
x |
Non-negative value. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Scale parameter. |
The density at x
.
Constructor function for multivariate phase-type distributions
mph(alpha = NULL, S = NULL, structure = NULL, dimension = 3, variables = NULL)
mph(alpha = NULL, S = NULL, structure = NULL, dimension = 3, variables = NULL)
alpha |
A probability vector. |
S |
A list of sub-intensity matrices. |
structure |
A vector of valid ph structures. |
dimension |
The dimension of the ph structure (if provided). |
variables |
The dimension of the multivariate phase-type. |
An object of class mph.
mph(structure = c("gcoxian", "general"), dimension = 5)
mph(structure = c("gcoxian", "general"), dimension = 5)
Class of objects for multivariate phase-type distributions.
Class object.
name
Name of the phase type distribution.
pars
A list comprising of the parameters.
fit
A list containing estimation information.
Constructor function for multivariate phase-type distributions (MPH* class)
MPHstar( alpha = NULL, S = NULL, structure = NULL, dimension = 3, R = NULL, variables = 2 )
MPHstar( alpha = NULL, S = NULL, structure = NULL, dimension = 3, R = NULL, variables = 2 )
alpha |
A probability vector. |
S |
A sub-intensity matrix. |
structure |
A valid ph structure. |
dimension |
The dimension of the ph structure (if provided). |
R |
A compatible (non-negative) reward matrix. |
variables |
The number of desired marginals. |
An object of class MPHstar.
MPHstar(structure = "general", dimension = 4, variables = 3)
MPHstar(structure = "general", dimension = 4, variables = 3)
Prepare data for the MPHstar_EMstep_UNI
MPHstar_data_aggregation(y, w = numeric(0))
MPHstar_data_aggregation(y, w = numeric(0))
y |
A matrix with marginal observations, each column corresponds to a marginal. |
w |
A matrix of weights, each column corresponds to a marginal. |
For summed and marginal observations we have a list with matrices of unique observations and their associated weights, separated by uncensored and right-censored data.
EM step using Uniformization for MPHstar class
MPHstar_EMstep_UNI(h, Rtol, alpha, S, R, mph_obs)
MPHstar_EMstep_UNI(h, Rtol, alpha, S, R, mph_obs)
h |
positive parameter for precision of uniformization method. |
Rtol |
The smallest value that a reward can take. |
alpha |
Vector of initial probabilities of the originating distribution. |
S |
The sub-intensity matrix of the originating distribution. |
R |
The reward matrix. |
mph_obs |
The list of summed, marginal observations with associated weights. |
Class of objects for multivariate phase type distributions.
name
Name of the phase type distribution.
pars
A list comprising of the parameters.
Computes the cdf (tail) of a matrix-Weibull distribution with parameters
alpha
, S
and beta
at x
.
mweibullcdf(x, alpha, S, beta, lower_tail = TRUE)
mweibullcdf(x, alpha, S, beta, lower_tail = TRUE)
x |
Non-negative value. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Shape parameter. |
lower_tail |
Cdf or tail. |
The cdf (tail) at x
.
Computes the density of a matrix-Weibull distribution with parameters
alpha
, S
and beta
at x
.
mweibullden(x, alpha, S, beta)
mweibullden(x, alpha, S, beta)
x |
Non-negative value. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Shape parameter. |
The density at x
.
Find how many states have positive reward
n_pos(R)
n_pos(R)
R |
reward vector |
The number of states with positive rewards
Given a transition matrix Q
, a uniform value u
, and a previous
state k
, it returns the new state of a Markov jump process.
new_state(prev_state, cum_embedded_mc, u)
new_state(prev_state, cum_embedded_mc, u)
prev_state |
Previous state of the Markov jump process. |
cum_embedded_mc |
Transition matrix. |
u |
Random value in (0,1). |
Next state of the Markov jump process.
Methods are available for objects of classes ph and dph.
Nfold(x1, x2, ...)
Nfold(x1, x2, ...)
x1 |
An object of the class dph. |
x2 |
An object of the model class. |
... |
Further parameters to be passed on. |
An object of the model class.
Nfold method for phase-type distributions
## S4 method for signature 'dph' Nfold(x1, x2)
## S4 method for signature 'dph' Nfold(x1, x2)
x1 |
An object of class ph. |
x2 |
An object of class dph. |
An object of class ph.
dph1 <- dph(structure = "general", dimension = 3) dph2 <- dph(structure = "general", dimension = 2) ph0 <- ph(structure = "general", dimension = 2) Nfold(dph1, ph0) Nfold(dph1, dph2)
dph1 <- dph(structure = "general", dimension = 3) dph2 <- dph(structure = "general", dimension = 2) ph0 <- ph(structure = "general", dimension = 2) Nfold(dph1, ph0) Nfold(dph1, dph2)
Methods are available for objects of class dph.
pgf(x, ...)
pgf(x, ...)
x |
An object of the model class. |
... |
Further parameters to be passed on. |
Pgf of the matrix distribution.
Pgf method for bivariate discrete phase-type distributions
## S4 method for signature 'bivdph' pgf(x, z)
## S4 method for signature 'bivdph' pgf(x, z)
x |
An object of class bivdph. |
z |
A vector of real values. |
The joint pdf of the dph object at the given location.
obj <- bivdph(dimensions = c(3, 3)) pgf(obj, c(0.5, 0.2))
obj <- bivdph(dimensions = c(3, 3)) pgf(obj, c(0.5, 0.2))
Pgf Method for discrete phase-type distributions
## S4 method for signature 'dph' pgf(x, z)
## S4 method for signature 'dph' pgf(x, z)
x |
An object of class dph. |
z |
A vector of real values. |
The probability generating of the dph object at the given locations.
set.seed(123) obj <- dph(structure = "general", dimension = 3) pgf(obj, 0.5)
set.seed(123) obj <- dph(structure = "general", dimension = 3) pgf(obj, 0.5)
Pgf method for multivariate discrete phase-type distributions
## S4 method for signature 'mdph' pgf(x, z)
## S4 method for signature 'mdph' pgf(x, z)
x |
An object of class mdph. |
z |
A matrix of real values. |
A vector containing the corresponding pgf evaluations.
obj <- mdph(structure = c("general", "general")) pgf(obj, matrix(c(0.5, 1), ncol = 2))
obj <- mdph(structure = c("general", "general")) pgf(obj, matrix(c(0.5, 1), ncol = 2))
Constructor function for phase-type distributions
ph(alpha = NULL, S = NULL, structure = NULL, dimension = 3)
ph(alpha = NULL, S = NULL, structure = NULL, dimension = 3)
alpha |
A probability vector. |
S |
A sub-intensity matrix. |
structure |
A valid ph structure: |
dimension |
The dimension of the ph structure (if structure is provided). |
An object of class ph.
ph(structure = "gcoxian", dimension = 5) ph(alpha = c(.5, .5), S = matrix(c(-1, .5, .5, -1), 2, 2))
ph(structure = "gcoxian", dimension = 5) ph(alpha = c(.5, .5), S = matrix(c(-1, .5, .5, -1), 2, 2))
Computes the Laplace transform at r
of a phase-type distribution with
parameters alpha
and S
.
ph_laplace(r, alpha, S)
ph_laplace(r, alpha, S)
r |
Vector of real values. |
alpha |
Vector of initial probabilities. |
S |
Sub-intensity matrix. |
Laplace transform at r
.
Class of objects for phase-type distributions.
Class object.
name
Name of the phase-type distribution.
pars
A list comprising of the parameters.
fit
A list containing estimation information.
Computes the cdf (tail) of a phase-type distribution with parameters
alpha
and S
at x
.
phcdf(x, alpha, S, lower_tail = TRUE)
phcdf(x, alpha, S, lower_tail = TRUE)
x |
Non-negative value. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
lower_tail |
Cdf or tail. |
The cdf (tail) at x
.
Computes the density of a phase-type distribution with parameters
alpha
and S
at x
.
phdensity(x, alpha, S)
phdensity(x, alpha, S)
x |
Non-negative value. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
The density at x
.
Find which states have positive reward
plus_states(R)
plus_states(R)
R |
reward vector |
A vector with the states (number) that are associated with positive rewards
Computes A^(2^n)
pow2_matrix(n, A)
pow2_matrix(n, A)
n |
An integer. |
A |
A matrix. |
A^(2^n).
Methods are available for objects of class ph.
quan(x, ...)
quan(x, ...)
x |
An object of the model class. |
... |
Further parameters to be passed on. |
Quantile from the matrix distribution.
Quantile method for phase-type distributions
## S4 method for signature 'ph' quan(x, p)
## S4 method for signature 'ph' quan(x, p)
x |
An object of class ph. |
p |
A vector of probabilities. |
A vector containing the quantile evaluations at the given locations.
obj <- ph(structure = "general") quan(obj, c(0.5, 0.9, 0.99))
obj <- ph(structure = "general") quan(obj, c(0.5, 0.9, 0.99))
Generates a random reward matrix for a multivariate phase-type distribution with p states and d marginals.
random_reward(p, d)
random_reward(p, d)
p |
Number of transient states in the sub-intensity matrix. |
d |
Number of marginals. |
A random reward matrix.
Generates random parameters alpha
and S
of a phase-type
distribution of dimension p
with chosen structure.
random_structure(p, structure = "general", scale_factor = 1)
random_structure(p, structure = "general", scale_factor = 1)
p |
Dimension of the phase-type. |
structure |
Type of structure: "general", "hyperexponential", "gerlang", "coxian" or "gcoxian". |
scale_factor |
A factor that multiplies the sub-intensity matrix. |
Random parameters alpha
and S
of a phase-type.
Generates random parameters alpha
, S11
, S12
, and S22
of a bivariate phase-type distribution of dimension p = p1 + p2
.
random_structure_bivph(p1, p2, scale_factor = 1)
random_structure_bivph(p1, p2, scale_factor = 1)
p1 |
Dimension of the first block. |
p2 |
Dimension of the second block. |
scale_factor |
A factor that multiplies the sub-intensity matrix. |
Random parameters alpha
, S11
, S12
, and S22
of a bivariate phase-type.
Generates a sample of size n
from a discrete phase-type distribution with
parameters alpha
and S
.
rdphasetype(n, alpha, S)
rdphasetype(n, alpha, S)
n |
Sample size. |
alpha |
Vector of initial probabilities. |
S |
Sub-transition matrix. |
Simulated sample.
Methods are available for objects of class ph.
reg(x, y, ...)
reg(x, y, ...)
x |
An object of the model class. |
y |
A vector of data. |
... |
Further parameters to be passed on. |
An object of the fitted model class.
Regression method for ph Class
## S4 method for signature 'ph' reg( x, y, weight = numeric(0), rcen = numeric(0), rcenweight = numeric(0), X = numeric(0), B0 = numeric(0), stepsEM = 1000, methods = c("RK", "UNI"), rkstep = NA, uni_epsilon = NA, optim_method = "BFGS", maxit = 50, reltol = 1e-08, every = 10 )
## S4 method for signature 'ph' reg( x, y, weight = numeric(0), rcen = numeric(0), rcenweight = numeric(0), X = numeric(0), B0 = numeric(0), stepsEM = 1000, methods = c("RK", "UNI"), rkstep = NA, uni_epsilon = NA, optim_method = "BFGS", maxit = 50, reltol = 1e-08, every = 10 )
x |
An object of class ph. |
y |
Vector or data. |
weight |
Vector of weights. |
rcen |
Vector of right-censored observations. |
rcenweight |
Vector of weights for right-censored observations. |
X |
Model matrix (no intercept needed). |
B0 |
Initial regression coefficients (optional). |
stepsEM |
Number of EM steps to be performed. |
methods |
Methods to use for matrix exponential calculation: |
rkstep |
Runge-Kutta step size (optional). |
uni_epsilon |
Epsilon parameter for uniformization method. |
optim_method |
Method to use in gradient optimization. |
maxit |
Maximum number of iterations when optimizing g function. |
reltol |
Relative tolerance when optimizing g function. |
every |
Number of iterations between likelihood display updates. |
An object of class sph.
set.seed(1) obj <- iph(ph(structure = "general", dimension = 2), gfun = "weibull", gfun_pars = 2) data <- sim(obj, n = 100) X <- runif(100) reg(x = obj, y = data, X = X, stepsEM = 10)
set.seed(1) obj <- iph(ph(structure = "general", dimension = 2), gfun = "weibull", gfun_pars = 2) data <- sim(obj, n = 100) X <- runif(100) reg(x = obj, y = data, X = X, stepsEM = 10)
Used for EM step in RK.
revers_data_trans(obs, weights, beta)
revers_data_trans(obs, weights, beta)
obs |
The observations. |
weights |
Weights of the observations. |
beta |
Parameters of the GEV. |
Transform a reward matrix with very small rewards to avoid numerical problems
rew_sanity_check(R, tol)
rew_sanity_check(R, tol)
R |
Reward matrix |
tol |
Lower bound considered for a reward |
A reward matrix that does not cause issues with uniformization
Generates a sample of size n
from an inhomogeneous phase-type
distribution with parameters alpha
, S
and beta
.
riph(n, dist_type, alpha, S, beta)
riph(n, dist_type, alpha, S, beta)
n |
Sample size. |
dist_type |
Type of IPH. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
beta |
Parameter of the transformation. |
The simulated sample.
Generates a sample of size n
from an inhomogeneous phase-type
distribution with parameters alpha
, S
and beta
.
rmatrixgev(n, alpha, S, mu, sigma, xi = 0)
rmatrixgev(n, alpha, S, mu, sigma, xi = 0)
n |
Sample size. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
mu |
Location parameter. |
sigma |
Scale parameter. |
xi |
Shape parameter: Default 0 which corresponds to the Gumbel case. |
The simulated sample.
Generates a sample of size n
from a MDPH* distribution with
parameters alpha
, S
, and R
.
rMDPHstar(n, alpha, S, R)
rMDPHstar(n, alpha, S, R)
n |
Sample size. |
alpha |
Vector of initial probabilities. |
S |
Sub-transition matrix. |
R |
Reward matrix. |
Simulated sample.
Generates a sample of size n
from a MIPH* distribution with parameters
alpha
, S
and R
.
rMIPHstar(n, alpha, S, R, gfun, gfun_par)
rMIPHstar(n, alpha, S, R, gfun, gfun_par)
n |
Sample size. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
R |
Reward matrix. |
gfun |
Vector with transformations names. |
gfun_par |
List with transformations parameters. |
The simulated sample.
Generates a sample of size n
from a MPH* distribution with parameters
alpha
, S
and R
.
rMPHstar(n, alpha, S, R)
rMPHstar(n, alpha, S, R)
n |
Sample size. |
alpha |
Initial probabilities. |
S |
Sub-intensity matrix. |
R |
Reward matrix. |
The simulated sample.
Generates a sample of size n
from a phase-type distribution with
parameters alpha
and S
.
rphasetype(n, alpha, S)
rphasetype(n, alpha, S)
n |
Sample size. |
alpha |
Vector of initial probabilities. |
S |
Sub-intensity matrix. |
Simulated sample.
Performs the Runge-Kutta method of fourth order.
runge_kutta(avector, bvector, cmatrix, dt, h, S, s)
runge_kutta(avector, bvector, cmatrix, dt, h, S, s)
avector |
The a vector. |
bvector |
The b vector. |
cmatrix |
The c matrix. |
dt |
The increment. |
h |
Step-length. |
S |
Sub-intensity matrix. |
s |
Exit rates. |
Show method for bivariate discrete phase-type distributions
## S4 method for signature 'bivdph' show(object)
## S4 method for signature 'bivdph' show(object)
object |
An object of class bivdph. |
Show method for bivariate inhomogeneous phase-type distributions
## S4 method for signature 'biviph' show(object)
## S4 method for signature 'biviph' show(object)
object |
An object of class biviph. |
Show method for bivariate phase-type distributions
## S4 method for signature 'bivph' show(object)
## S4 method for signature 'bivph' show(object)
object |
An object of class bivph. |
Show method for discrete phase-type distributions
## S4 method for signature 'dph' show(object)
## S4 method for signature 'dph' show(object)
object |
An object of class dph. |
Show method for inhomogeneous phase-type distributions
## S4 method for signature 'iph' show(object)
## S4 method for signature 'iph' show(object)
object |
An object of class iph. |
Show method for multivariate discrete phase-type distributions
## S4 method for signature 'mdph' show(object)
## S4 method for signature 'mdph' show(object)
object |
An object of class mdph. |
Show method for multivariate inhomogeneous phase-type distributions
## S4 method for signature 'miph' show(object)
## S4 method for signature 'miph' show(object)
object |
An object of class miph. |
Show method for multivariate phase-type distributions
## S4 method for signature 'mph' show(object)
## S4 method for signature 'mph' show(object)
object |
An object of class mph. |
Show method for multivariate phase-type distributions
## S4 method for signature 'MPHstar' show(object)
## S4 method for signature 'MPHstar' show(object)
object |
An object of class MPHstar. |
Show method for phase-type distributions
## S4 method for signature 'ph' show(object)
## S4 method for signature 'ph' show(object)
object |
An object of class ph. |
Show method for survival phase-type objects
## S4 method for signature 'sph' show(object)
## S4 method for signature 'sph' show(object)
object |
An object of class sph. |
Methods are available for objects of class ph.
sim(x, ...)
sim(x, ...)
x |
An object of the model class. |
... |
Further parameters to be passed on. |
A realization from the matrix distribution.
Simulation method for bivariate discrete phase-type distributions
## S4 method for signature 'bivdph' sim(x, n = 1000)
## S4 method for signature 'bivdph' sim(x, n = 1000)
x |
An object of class bivdph. |
n |
An integer of length of realization. |
A realization of independent and identically distributed bivariate discrete phase-type vector.
obj <- bivdph(dimensions = c(3, 3)) sim(obj, n = 100)
obj <- bivdph(dimensions = c(3, 3)) sim(obj, n = 100)
Simulation method for bivariate inhomogeneous phase-type distributions
## S4 method for signature 'biviph' sim(x, n = 1000)
## S4 method for signature 'biviph' sim(x, n = 1000)
x |
An object of class biviph. |
n |
An integer of length of realization. |
A realization of independent and identically distributed bivariate inhomogeneous phase-type vector.
under_bivph <- bivph(dimensions = c(3, 3)) obj <- biviph(under_bivph, gfun = c("weibull", "pareto"), gfun_pars = list(c(2), c(3))) sim(obj, n = 100)
under_bivph <- bivph(dimensions = c(3, 3)) obj <- biviph(under_bivph, gfun = c("weibull", "pareto"), gfun_pars = list(c(2), c(3))) sim(obj, n = 100)
Simulation method for bivariate phase-type distributions
## S4 method for signature 'bivph' sim(x, n = 1000)
## S4 method for signature 'bivph' sim(x, n = 1000)
x |
An object of class bivph. |
n |
An integer of length of realization. |
A realization of independent and identically distributed bivariate phase-type vector.
obj <- bivph(dimensions = c(3, 3)) sim(obj, n = 100)
obj <- bivph(dimensions = c(3, 3)) sim(obj, n = 100)
Simulation method for phase-type distributions
## S4 method for signature 'dph' sim(x, n = 1000)
## S4 method for signature 'dph' sim(x, n = 1000)
x |
An object of class dph. |
n |
An integer of length of realization. |
A realization of independent and identically distributed discrete phase-type variables.
obj <- dph(structure = "general") sim(obj, n = 100)
obj <- dph(structure = "general") sim(obj, n = 100)
Simulation method for inhomogeneous phase-type distributions
## S4 method for signature 'iph' sim(x, n = 1000)
## S4 method for signature 'iph' sim(x, n = 1000)
x |
An object of class iph. |
n |
An integer of length of realization. |
A realization of independent and identically distributed inhomogeneous phase-type variables.
obj <- iph(ph(structure = "general"), gfun = "lognormal", gfun_pars = 2) sim(obj, n = 100)
obj <- iph(ph(structure = "general"), gfun = "lognormal", gfun_pars = 2) sim(obj, n = 100)
Simulation method for multivariate discrete phase-type distributions
## S4 method for signature 'mdph' sim(x, n = 1000, equal_marginals = 0)
## S4 method for signature 'mdph' sim(x, n = 1000, equal_marginals = 0)
x |
An object of class mdph. |
n |
Length of realization. |
equal_marginals |
Non-negative integer. If positive, it specifies the number of marginals to simulate from, all from the first matrix. |
A realization of a multivariate discrete phase-type distribution.
obj <- mdph(structure = c("general", "general")) sim(obj, 100)
obj <- mdph(structure = c("general", "general")) sim(obj, 100)
Simulation method for inhomogeneous multivariate phase-type distributions
## S4 method for signature 'miph' sim(x, n = 1000)
## S4 method for signature 'miph' sim(x, n = 1000)
x |
An object of class miph. |
n |
An integer of length of realization. |
A realization of independent and identically distributed inhomogeneous multivariate phase-type variables. If x is a MoE miph an array of dimension c(n,d,m) is returned, with d the number of marginals and m the number of initial distribution vectors.
under_mph <- mph(structure = c("general", "general")) obj <- miph(under_mph, gfun = c("weibull", "pareto"), gfun_pars = list(c(2), c(3))) sim(obj, 100)
under_mph <- mph(structure = c("general", "general")) obj <- miph(under_mph, gfun = c("weibull", "pareto"), gfun_pars = list(c(2), c(3))) sim(obj, 100)
Simulation method for multivariate phase-type distributions
## S4 method for signature 'mph' sim(x, n = 1000, equal_marginals = 0)
## S4 method for signature 'mph' sim(x, n = 1000, equal_marginals = 0)
x |
An object of class mph. |
n |
Length of realization. |
equal_marginals |
Non-negative integer. If positive, it specifies the number of marginals to simulate from, all from the first matrix. |
A realization of a multivariate phase-type distribution.
obj <- mph(structure = c("general", "general")) sim(obj, 100)
obj <- mph(structure = c("general", "general")) sim(obj, 100)
Simulation method for multivariate phase-type distributions
## S4 method for signature 'MPHstar' sim(x, n = 1000)
## S4 method for signature 'MPHstar' sim(x, n = 1000)
x |
An object of class MPHstar. |
n |
Desired sample size for each marginal. |
A matrix of sample data for each marginal.
obj <- MPHstar(structure = "general") sim(obj, 100)
obj <- MPHstar(structure = "general") sim(obj, 100)
Simulation method for phase-type distributions
## S4 method for signature 'ph' sim(x, n = 1000)
## S4 method for signature 'ph' sim(x, n = 1000)
x |
An object of class ph. |
n |
An integer of length of realization. |
A realization of independent and identically distributed phase-type variables.
obj <- ph(structure = "general") sim(obj, n = 100)
obj <- ph(structure = "general") sim(obj, n = 100)
Constructor function for survival phase-type objects
sph(x = NULL, coefs = list(B = numeric(0), C = numeric(0)), type = "reg")
sph(x = NULL, coefs = list(B = numeric(0), C = numeric(0)), type = "reg")
x |
An object of class ph. |
coefs |
Coefficients of the survival regression object. |
type |
Type of survival object. |
An object of class sph.
Class of objects for inhomogeneous phase-type distributions
Class object
coefs
Coefficients of the survival regression object.
type
Type of survival object.
Computes the initial distribution and sub-intensity of the sum of two discrete phase-type distributed random variables
sum_dph(alpha1, S1, alpha2, S2)
sum_dph(alpha1, S1, alpha2, S2)
alpha1 |
Initial distribution. |
S1 |
Sub-transition matrix. |
alpha2 |
Initial distribution. |
S2 |
Sub-transition matrix. |
Computes the initial distribution and sub-intensity of the sum of two phase-type distributed random variables.
sum_ph(alpha1, S1, alpha2, S2)
sum_ph(alpha1, S1, alpha2, S2)
alpha1 |
Initial distribution. |
S1 |
Sub-intensity matrix. |
alpha2 |
Initial distribution. |
S2 |
Sub-intensity matrix. |
Methods are available for objects of class ph
TVR(x, ...)
TVR(x, ...)
x |
An object of the model class. |
... |
Further parameters to be passed on. |
An object of the model class.
Performs TVR for discrete phase-type distributions
tvr_dph(alpha, S, R)
tvr_dph(alpha, S, R)
alpha |
Initial distribution vector. |
S |
Sub-intensity matrix. |
R |
Reward vector. |
A list of PH parameters.
Performs TVR for phase-type distributions
tvr_ph(alpha, S, R)
tvr_ph(alpha, S, R)
alpha |
Initial distribution vector. |
S |
Sub-intensity matrix. |
R |
Reward vector. |
A list of phase-type parameters.
TVR Method for dph Class
## S4 method for signature 'dph' TVR(x, rew)
## S4 method for signature 'dph' TVR(x, rew)
x |
An object of class dph. |
rew |
A vector of rewards. |
An object of the of class dph.
obj <- dph(structure = "general") TVR(obj, c(1, 0, 1))
obj <- dph(structure = "general") TVR(obj, c(1, 0, 1))
TVR method for ph class
## S4 method for signature 'ph' TVR(x, rew)
## S4 method for signature 'ph' TVR(x, rew)
x |
An object of class ph. |
rew |
A vector of rewards. |
An object of the of class ph.
obj <- ph(structure = "general") TVR(obj, c(1, 2, 3))
obj <- ph(structure = "general") TVR(obj, c(1, 2, 3))
Var method for bivdph class
## S4 method for signature 'bivdph' var(x)
## S4 method for signature 'bivdph' var(x)
x |
An object of class bivdph. |
The covariance matrix of the bivariate discrete phase-type distribution.
obj <- bivdph(dimensions = c(3, 3)) var(obj)
obj <- bivdph(dimensions = c(3, 3)) var(obj)
Var method for bivph class
## S4 method for signature 'bivph' var(x)
## S4 method for signature 'bivph' var(x)
x |
An object of class bivph. |
The covariance matrix of the bivariate phase-type distribution.
obj <- bivph(dimensions = c(3, 3)) var(obj)
obj <- bivph(dimensions = c(3, 3)) var(obj)
Var method for discrete phase-type distributions
## S4 method for signature 'dph' var(x)
## S4 method for signature 'dph' var(x)
x |
An object of class dph. |
The variance of the dph object.
set.seed(123) obj <- dph(structure = "general", dimension = 3) var(obj)
set.seed(123) obj <- dph(structure = "general", dimension = 3) var(obj)
Var method for multivariate discrete phase-type distributions
## S4 method for signature 'mdph' var(x)
## S4 method for signature 'mdph' var(x)
x |
An object of class mdph. |
The covariance matrix of the multivariate discrete phase-type distribution.
obj <- mdph(structure = c("general", "general")) var(obj)
obj <- mdph(structure = c("general", "general")) var(obj)
Var method for multivariate phase-type distributions
## S4 method for signature 'mph' var(x)
## S4 method for signature 'mph' var(x)
x |
An object of class mph. |
The covariance matrix of the multivariate phase-type distribution.
obj <- mph(structure = c("general", "general")) var(obj)
obj <- mph(structure = c("general", "general")) var(obj)
Var method for MPHstar class
## S4 method for signature 'MPHstar' var(x)
## S4 method for signature 'MPHstar' var(x)
x |
An object of class MPHstar. |
The covariance matrix of the MPHstar distribution.
obj <- MPHstar(structure = "general") var(obj)
obj <- MPHstar(structure = "general") var(obj)
Var method for phase-type distributions
## S4 method for signature 'ph' var(x)
## S4 method for signature 'ph' var(x)
x |
An object of class ph. |
The variance of the ph (or underlying ph) object.
set.seed(123) obj <- ph(structure = "general", dimension = 3) var(obj)
set.seed(123) obj <- ph(structure = "general", dimension = 3) var(obj)
Computes the elements S^n / n! until the a given size
vector_of_matrices(vect, S, a, vect_size)
vector_of_matrices(vect, S, a, vect_size)
vect |
A vector. |
S |
Sub-intensity matrix. |
a |
A number. |
vect_size |
Size of vector. |
Computes the elements S^n / n! until given value of n
vector_of_matrices_2(vect, S, vect_size)
vector_of_matrices_2(vect, S, vect_size)
vect |
A vector. |
S |
Sub-intensity matrix. |
vect_size |
Size of vector. |
Computes elements A^n until the given size
vector_of_powers(A, vect_size)
vector_of_powers(A, vect_size)
A |
A matrix. |
vect_size |
Size of vector. |