calhoun.analysis.crf.statistics
Class PredictedActualBinaryContingencyTable

java.lang.Object
  extended by calhoun.analysis.crf.statistics.PredictedActualBinaryContingencyTable
All Implemented Interfaces:
java.io.Serializable

public class PredictedActualBinaryContingencyTable
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Constructor Summary
PredictedActualBinaryContingencyTable()
           
 
Method Summary
 int an()
          Actual Negatives
 int ap()
          Actual Positives
 double approximateCorrelation()
          This is the approximate correlation.
 double averageConditionalProbability()
          This is the average conditional probability.
 double averageSensitivitySpecificity()
          This is the average of sensitivity and specifity.
 double correlationCoefficient()
          This is the Pearson correlation of two 0-1 random variables X=prediction and Y=reality CC = Cov(X,Y)/(Stddev(X)*Stddev(Y)) If either RV has zero variance, the CC is underfined: assertion faliure If this contingency table is not tracking TN, then CC is undefined: assertion failure
 void forgetTN()
           
 void freeze()
           
 int getFN()
           
 int getFP()
           
 int getTN()
           
 int getTP()
           
 void increment(boolean predicted, boolean actual)
           
 void incrementFN()
           
 void incrementFP()
           
 void incrementTN()
           
 void incrementTP()
           
 int pn()
          Predicted Negatives
 int pp()
          Predicted Positives
 double sensitivity()
          Sensitivity is TP/(TP+FN) is the fraction of actual events that are predicted.
 void set(int tp, int fp, int fn)
           
 void set(int tp, int fp, int fn, int tn)
           
 double specificity()
          Specificity is the TP/(TP+FP) is the fraction of predicted events that are real.
 java.lang.String summarize()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PredictedActualBinaryContingencyTable

public PredictedActualBinaryContingencyTable()
Method Detail

set

public void set(int tp,
                int fp,
                int fn,
                int tn)

set

public void set(int tp,
                int fp,
                int fn)

forgetTN

public void forgetTN()

incrementTP

public void incrementTP()

incrementFP

public void incrementFP()

incrementFN

public void incrementFN()

incrementTN

public void incrementTN()

increment

public void increment(boolean predicted,
                      boolean actual)

freeze

public void freeze()

getTP

public int getTP()

getFP

public int getFP()

getFN

public int getFN()

getTN

public int getTN()

ap

public int ap()
Actual Positives


an

public int an()
Actual Negatives


pp

public int pp()
Predicted Positives


pn

public int pn()
Predicted Negatives


correlationCoefficient

public double correlationCoefficient()
This is the Pearson correlation of two 0-1 random variables X=prediction and Y=reality CC = Cov(X,Y)/(Stddev(X)*Stddev(Y)) If either RV has zero variance, the CC is underfined: assertion faliure If this contingency table is not tracking TN, then CC is undefined: assertion failure


averageConditionalProbability

public double averageConditionalProbability()
This is the average conditional probability. Only defined if TN is being tracked, and if all four marginal values are positive.


approximateCorrelation

public double approximateCorrelation()
This is the approximate correlation. Only defined if TN is being tracked, and if all four marginal values are positive. Equal to 2*(averageConditionalProbability - 0.5)


averageSensitivitySpecificity

public double averageSensitivitySpecificity()
This is the average of sensitivity and specifity. This is equal to the limit of ACP as TN->infinity This is defined even if we are not tracking TN.


sensitivity

public double sensitivity()
Sensitivity is TP/(TP+FN) is the fraction of actual events that are predicted. If TP+FN is zero then sensitivity is undefined, resulting in assertion failure Sensitivity is defined even if not tracking TN.


specificity

public double specificity()
Specificity is the TP/(TP+FP) is the fraction of predicted events that are real. If TP+FP=0 then specificity is undefined and result in assertion failure Specificity is defined even if not tracking TN


summarize

public java.lang.String summarize()