jphase
Class HyperErlangVar

java.lang.Object
  extended by jphase.AbstractContPhaseVar
      extended by jphase.HyperErlangVar
All Implemented Interfaces:
JMarkovElement, ContPhaseVar, PhaseVar

public class HyperErlangVar
extends AbstractContPhaseVar
implements PhaseVar

Version:
0.1 This class allows the creation and manipulation of HyperErlang distributions. The associated matrix has dense representation
Author:
German Riaņo, Juan Fernando Perez

Constructor Summary
HyperErlangVar()
          Constructor of a Hyper Erlang variable in dense representation.
HyperErlangVar(int n)
          Constructor of a Hyper Erlang variable with n phases in dense representation
HyperErlangVar(int[] r, double[] alphas, double[] lambdas, boolean deep)
          Constructor of a Hyper Erlang variable in dense representation
HyperErlangVar(int N, int M, int[] r, double[] alphas, double[] lambdas, boolean deep)
          Constructor of a Hyper Erlang variable in dense representation
 
Method Summary
 double cdf(double x)
          Evaluates the cumulative density function at x
 double[] cdf(int n, double delta)
          Evaluates the Cumulative Density Function at n values of x, starting with x=0, step delta
 ContPhaseVar copy()
          Creates a deep copy of the original Phase-Type Variable
 java.lang.String description()
          This method return a complete verbal describtion of this element.
 double expectedValue()
          Computes the Expected Value of the Phase variable
 double[] getAlphas()
           
 double[] getLambdas()
           
 int getM()
           
 no.uib.cipr.matrix.Matrix getMatrix()
          Returns the transition matrix of the Phase-Type Distribution
 int getN()
           
 int[] getR()
           
 no.uib.cipr.matrix.Vector getVector()
          Returns the initial probability mass vector
 double moment(int k)
          Compuetes the k-th Moment of the Phase variable
 ContPhaseVar newVar(int n)
          Creates a new variable of the same class of the original Continuous Phase-Type Variable
 double pdf(double x)
          Evaluates the probability density function at x
 double[] pdf(int n, double delta)
          Evaluates the Probability Density Function at n values of x, starting with x=0, step delta
 void setAlphas(double[] alphas)
           
 void setLambdas(double[] lambdas)
           
 void setM(int M)
           
 void setMatrix(no.uib.cipr.matrix.Matrix A)
          Rate Matrix = A
 void setN(int N)
           
 void setR(int[] r)
           
 void setVector(no.uib.cipr.matrix.Vector alpha)
          Initial Probability vector = alpha
 
Methods inherited from class jphase.AbstractContPhaseVar
CV, eqResidualTime, getMat0, getMat0Array, getMatrixArray, getNumPhases, getVec0, getVectorArray, label, lossFunction1, lossFunction2, max, max, median, min, min, mix, mix, prob, quantil, residualTime, residualVar, stdDeviation, sum, sum, sumGeom, sumPH, sumPH, survival, survival, times, toString, variance, waitingQ
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jphase.PhaseVar
CV, getMat0, getMat0Array, getMatrixArray, getNumPhases, getVec0, getVectorArray, lossFunction1, lossFunction2, median, prob, quantil, stdDeviation, survival, survival, variance
 
Methods inherited from interface jmarkov.basic.JMarkovElement
equals, label, toString
 

Constructor Detail

HyperErlangVar

public HyperErlangVar()
Constructor of a Hyper Erlang variable in dense representation. As default it has just one branch that is taken with probability one. the unique branch has one phase with rate 1 per time unit.


HyperErlangVar

public HyperErlangVar(int n)
Constructor of a Hyper Erlang variable with n phases in dense representation

Parameters:
n - Total number of phases

HyperErlangVar

public HyperErlangVar(int N,
                      int M,
                      int[] r,
                      double[] alphas,
                      double[] lambdas,
                      boolean deep)
Constructor of a Hyper Erlang variable in dense representation

Parameters:
N - Total number of phases
M - Number of branches
r - Number of phases in each branch
alphas - Probability associated to each branch
lambdas - Rate associated to each branch
deep - True if this is a deep constructor, false if not

HyperErlangVar

public HyperErlangVar(int[] r,
                      double[] alphas,
                      double[] lambdas,
                      boolean deep)
Constructor of a Hyper Erlang variable in dense representation

Parameters:
r - Number of phases in each branch
alphas - Probability associated to each branch
lambdas - Rate associated to each branch
deep - True if this is a deep constructor, false if not
Method Detail

getN

public int getN()
Returns:
Total number of phases

setN

public void setN(int N)
Parameters:
N - Total number of phases to set

getM

public int getM()
Returns:
Nnumber of branches

setM

public void setM(int M)
Parameters:
M - Number of branches to set

getR

public int[] getR()
Returns:
Number of phases in each branch

setR

public void setR(int[] r)
Parameters:
r - Number of phases in each branch to set

getAlphas

public double[] getAlphas()
Returns:
Probability associated to each branch

setAlphas

public void setAlphas(double[] alphas)
Parameters:
alphas - Probability associated to each branch to set

getLambdas

public double[] getLambdas()
Returns:
Rate associated to each branch

setLambdas

public void setLambdas(double[] lambdas)
Parameters:
lambdas - Rates associated to each branch to set

getMatrix

public no.uib.cipr.matrix.Matrix getMatrix()
Description copied from interface: PhaseVar
Returns the transition matrix of the Phase-Type Distribution

Specified by:
getMatrix in interface PhaseVar
Returns:
Transition matrix for transient states of the Phase-Type Distribution

setMatrix

public void setMatrix(no.uib.cipr.matrix.Matrix A)
Description copied from interface: PhaseVar
Rate Matrix = A

Specified by:
setMatrix in interface PhaseVar
Parameters:
A - Transition matrix for transient states of the Phase-Type Distribution

getVector

public no.uib.cipr.matrix.Vector getVector()
Description copied from interface: PhaseVar
Returns the initial probability mass vector

Specified by:
getVector in interface PhaseVar
Returns:
Initial probability mass vector

setVector

public void setVector(no.uib.cipr.matrix.Vector alpha)
Description copied from interface: PhaseVar
Initial Probability vector = alpha

Specified by:
setVector in interface PhaseVar
Parameters:
alpha - Initial probability mass vector

copy

public ContPhaseVar copy()
Description copied from interface: ContPhaseVar
Creates a deep copy of the original Phase-Type Variable

Specified by:
copy in interface ContPhaseVar
Specified by:
copy in interface PhaseVar
Returns:
A deep copy of the original Phase-Type Variable

newVar

public ContPhaseVar newVar(int n)
Description copied from interface: ContPhaseVar
Creates a new variable of the same class of the original Continuous Phase-Type Variable

Specified by:
newVar in interface ContPhaseVar
Parameters:
n - number of Phases of the new Variable
Returns:
A new variable of the same class of the original Continuous Phase-Type Variable

cdf

public double cdf(double x)
Description copied from interface: PhaseVar
Evaluates the cumulative density function at x

Specified by:
cdf in interface PhaseVar
Overrides:
cdf in class AbstractContPhaseVar
Parameters:
x - Evaluation point
Returns:
Cumulative density function at x
See Also:
PhaseVar.cdf(double)

cdf

public double[] cdf(int n,
                    double delta)
Description copied from interface: PhaseVar
Evaluates the Cumulative Density Function at n values of x, starting with x=0, step delta

Specified by:
cdf in interface PhaseVar
Overrides:
cdf in class AbstractContPhaseVar
Parameters:
n - number of evaluation points
delta - distance between evaluation points
Returns:
Evaluation of the survival Function at x = 0,d,2d,..,(n-1)d
See Also:
PhaseVar.cdf(int, double)

pdf

public double pdf(double x)
Description copied from interface: ContPhaseVar
Evaluates the probability density function at x

Specified by:
pdf in interface ContPhaseVar
Overrides:
pdf in class AbstractContPhaseVar
Parameters:
x - Evaluation point
Returns:
Probability density function at x
See Also:
ContPhaseVar.pdf(double)

pdf

public double[] pdf(int n,
                    double delta)
Description copied from interface: ContPhaseVar
Evaluates the Probability Density Function at n values of x, starting with x=0, step delta

Specified by:
pdf in interface ContPhaseVar
Overrides:
pdf in class AbstractContPhaseVar
Parameters:
n - number of evaluation points
delta - distance between evaluation points
Returns:
Evaluation of the probability density function at x = 0,d,2d,..,(n-1)d
See Also:
ContPhaseVar.pdf(int, double)

expectedValue

public double expectedValue()
Description copied from interface: PhaseVar
Computes the Expected Value of the Phase variable

Specified by:
expectedValue in interface PhaseVar
Overrides:
expectedValue in class AbstractContPhaseVar
Returns:
Expected Value of the Phase variable
See Also:
PhaseVar.expectedValue()

moment

public double moment(int k)
Description copied from interface: PhaseVar
Compuetes the k-th Moment of the Phase variable

Specified by:
moment in interface PhaseVar
Overrides:
moment in class AbstractContPhaseVar
Parameters:
k - Moment
Returns:
k-th Moment of the Phase variable
See Also:
PhaseVar.moment(int)

description

public java.lang.String description()
Description copied from interface: JMarkovElement
This method return a complete verbal describtion of this element. This description may contain multiple text rows.

Specified by:
description in interface JMarkovElement
Overrides:
description in class AbstractContPhaseVar
Returns:
A String describing this element.
See Also:
JMarkovElement.label()