Search Results for

    Show / Hide Table of Contents

    Class LLR

    This class is used to calculate a simple log likelihood ratio for a matrix of counts over two variables that take discrete values. There is no constructor. All methods are static. Author: Michael Towsey.

    Inheritance
    Object
    LLR
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: TowseyLibrary
    Assembly: TowseyLibrary.dll
    Syntax
    public static class LLR

    Methods

    | Improve this Doc View Source

    CalculateLogLikelihoodRatio(Double, Double)

    See Wikipedia on LLR -2log(Lambda) = -2LLR = 2log[p(x|B)/p(x|Bo)] = 2log[p(x|B)] - 2log[p(x|Bo)] therefore LLR = log[p(x|Bo)] - log[p(x|B)] where x is the observation. where Bo are the parameters of the null hypothesis where B are the parameters of alternative hypothesis.

    Declaration
    public static double CalculateLogLikelihoodRatio(double unigramLogScore, double bigramLogScore)
    Parameters
    Type Name Description
    Double unigramLogScore

    log likelihood of the null hypothesis.

    Double bigramLogScore

    log likelihood of the alernative hypothesis.

    Returns
    Type Description
    Double
    | Improve this Doc View Source

    CellExpectedValue(Int32[,], Int32, Int32, Int32)

    Declaration
    public static double CellExpectedValue(int[, ] table, int row, int column, int totalCount)
    Parameters
    Type Name Description
    Int32[,] table
    Int32 row
    Int32 column
    Int32 totalCount
    Returns
    Type Description
    Double
    | Improve this Doc View Source

    ChiSquare(Int32[,], Double[,], out Double, out Int32)

    Calculates the chi square statistic from a contingency table and the transition frequenices of a Markov Model. See my statistics book for engineers and scientists, Walpole and Myers, p345.

    Declaration
    public static void ChiSquare(int[, ] contingencyTable, double[, ] expectedRf, out double chi2, out int df)
    Parameters
    Type Name Description
    Int32[,] contingencyTable
    Double[,] expectedRf
    Double chi2
    Int32 df
    | Improve this Doc View Source

    ChiSquare_DF1(Double)

    Declaration
    public static double ChiSquare_DF1(double chi)
    Parameters
    Type Name Description
    Double chi
    Returns
    Type Description
    Double
    | Improve this Doc View Source

    ChiSquare_DFn(Double, Int32)

    Declaration
    public static double ChiSquare_DFn(double chi2, int df)
    Parameters
    Type Name Description
    Double chi2
    Int32 df
    Returns
    Type Description
    Double
    | Improve this Doc View Source

    ColumnRelativeFrequency(Int32[,], Int32, Int32)

    Declaration
    public static double ColumnRelativeFrequency(int[, ] table, int column, int totalCount)
    Parameters
    Type Name Description
    Int32[,] table
    Int32 column
    Int32 totalCount
    Returns
    Type Description
    Double
    | Improve this Doc View Source

    GetLLRs(Int32[,])

    Declaration
    public static double[, ] GetLLRs(int[, ] contingencyTable)
    Parameters
    Type Name Description
    Int32[,] contingencyTable
    Returns
    Type Description
    Double[,]
    | Improve this Doc View Source

    RowRelativeFrequency(Int32[,], Int32, Int32)

    Declaration
    public static double RowRelativeFrequency(int[, ] table, int row, int totalCount)
    Parameters
    Type Name Description
    Int32[,] table
    Int32 row
    Int32 totalCount
    Returns
    Type Description
    Double
    | Improve this Doc View Source

    WriteLogLikelihoodRatioMatrix(Double[,])

    Declaration
    public static string WriteLogLikelihoodRatioMatrix(double[, ] m)
    Parameters
    Type Name Description
    Double[,] m
    Returns
    Type Description
    String
    • Improve this Doc
    • View Source
    In This Article
    Generated by DocFX AP docs version: 21.7.0.4-master-e26127a50d7bd7472d47288f10e61014fb981f7f-DIRTY-CI:144 Back to top