Class EMpht

  • All Implemented Interfaces:

    
    public final class EMpht
    
                        

    Kotlin port of EMpht.c - EM algorithm for fitting Phase-type distributions Latest corrections made 9 March, 1998

    • Constructor Detail

      • EMpht

        EMpht()
    • Method Detail

      • fitPhaseType

         final static Triple<Matrix, Matrix, Matrix> fitPhaseType(Matrix observations, Matrix weights, Matrix censored, Matrix censorWeights, Integer p, Integer structure, Integer maxIter)

        Fit a phase-type distribution using EM algorithm

        Parameters:
        observations - Matrix (n x 1) of observation times
        weights - Matrix (n x 1) of observation weights
        censored - Matrix (m x 1) of censored observation times (optional)
        censorWeights - Matrix (m x 1) of censored observation weights (optional)
        p - Number of phases
        structure - Structure of the phase-type distribution (1-8)
        maxIter - Maximum number of EM iterations
        Returns:

        Tuple of (pi, T, exitRates) as Matrix objects

      • computeLogLikelihoodMatrix

         final static Double computeLogLikelihoodMatrix(Matrix observations, Matrix weights, Matrix pi, Matrix T, Matrix exitRates)

        Compute the log-likelihood of observations given phase-type parameters

        Parameters:
        observations - Matrix (n x 1) of observation times
        weights - Matrix (n x 1) of observation weights
        pi - Matrix (p x 1) of initial probabilities
        T - Matrix (p x p) of transition rates
        exitRates - Matrix (p x 1) of exit rates
        Returns:

        Log-likelihood value

      • emStepMatrix

         final static Triple<Matrix, Matrix, Matrix> emStepMatrix(Matrix pi, Matrix T, Matrix exitRates, Matrix observations, Matrix weights)

        Run a single EM step with Matrix input/output

        Parameters:
        pi - Matrix (p x 1) of initial probabilities
        T - Matrix (p x p) of transition rates
        exitRates - Matrix (p x 1) of exit rates
        observations - Matrix (n x 1) of observation times
        weights - Matrix (n x 1) of observation weights
        Returns:

        Updated (pi, T, exitRates) as Matrix objects

      • generateRandomPhaseType

         final static Triple<Matrix, Matrix, Matrix> generateRandomPhaseType(Integer p, Integer structure)

        Generate a random phase-type distribution with Matrix output

        Parameters:
        p - Number of phases
        structure - Structure type (1-5)
        Returns:

        Tuple of (pi, T, exitRates) as Matrix objects