corina.cross
Class DScore

java.lang.Object
  |
  +--corina.cross.Cross
        |
        +--corina.cross.DScore
All Implemented Interfaces:
Runnable

public class DScore
extends Cross

Class for computing the hybrid "D-Score" ("Dating Score"). The D-score is defined for each year i as:

D = { (tr - 50%) ⋅ t tr > 50%
0.0 tr ≤ 50%

Version:
$Id: DScore.java,v 1.3 2002/10/29 14:54:26 bitpoet Exp $
Author:
Ken Harris
See Also:
TScore, Trend

Fields inherited from class corina.cross.Cross
data, fixed, highScores, moving, msg
 
Constructor Summary
protected DScore()
           
  DScore(Sample s1, Sample s2)
          Construct a D-Score from two uncrossed samples.
  DScore(TScore t, Trend tr)
          Construct a D-Score from two (possibly already-run) crosses, the T-Score and Trend for a given pair of samples.
 
Method Summary
 double compute(int offset_fixed, int offset_moving)
          Compute a single D-score, i.e., the D-score between the two samples for a given possible position.
 String getFormat()
          A format string for D-scores.
 double getMinimumSignificant()
           
 String getName()
          Return a nicer string of this cross, "D-Score".
 boolean isSignificant(double score, int overlap)
           
protected  void preamble()
          Run any un-run crosses.
 float single()
          Run a single crossdate on the (absolutely-dated) samples.
 
Methods inherited from class corina.cross.Cross
getFixed, getMinimumOverlap, getMoving, isFinished, run, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DScore

protected DScore()

DScore

public DScore(Sample s1,
              Sample s2)
Construct a D-Score from two uncrossed samples. This requires calculating the T-Score and Trends first, so used this way, this is the slowest cross.
Parameters:
s1 - fixed sample to use
s2 - moving sample to use

DScore

public DScore(TScore t,
              Trend tr)
Construct a D-Score from two (possibly already-run) crosses, the T-Score and Trend for a given pair of samples. If this constructor is used and the crosses have previously been run, they are not run again (making this the fastest cross).
Parameters:
t - TScore to use
tr - Trend to use
Method Detail

getName

public String getName()
Return a nicer string of this cross, "D-Score".
Overrides:
getName in class Cross
Returns:
the name of this cross, "D-Score"

getFormat

public String getFormat()
A format string for D-scores.
Overrides:
getFormat in class Cross
Returns:
a format string for D-scores

isSignificant

public boolean isSignificant(double score,
                             int overlap)
Overrides:
isSignificant in class Cross

getMinimumSignificant

public double getMinimumSignificant()
Overrides:
getMinimumSignificant in class Cross

preamble

protected void preamble()
Run any un-run crosses.
Overrides:
preamble in class Cross
See Also:
TScore, Trend

single

public float single()
Description copied from class: Cross
Run a single crossdate on the (absolutely-dated) samples. Member highScores remains empty, and finished remains false. The offsets are derived from the dates of the samples, which are assumed to be absolutely dated.
Overrides:
single in class Cross
Following copied from class: corina.cross.Cross
Returns:
the crossdate score between the samples at their saved positions

compute

public double compute(int offset_fixed,
                      int offset_moving)
Compute a single D-score, i.e., the D-score between the two samples for a given possible position. Because it's a composite of two other algorithms that have already been run, the first step is to compute the index into the T-score and trend vectors.
Overrides:
compute in class Cross
Parameters:
offset_fixed - index into the fixed sample to start
offset_moving - index into the moving sample to start
Returns:
D-score for these offsets