vec_math
Class AbstractMultidimensionalDataModel

java.lang.Object
  extended by vec_math.AbstractMultidimensionalDataModel
All Implemented Interfaces:
MultidimensionalDataModel
Direct Known Subclasses:
WcsModel

public abstract class AbstractMultidimensionalDataModel
extends Object
implements MultidimensionalDataModel

An abstract data model is an implementation of a data model that allows the user to get access to the data it is constructed with. For use, implement MultidimensionalDataModel.getParameterCount() and MultidimensionalDataModel.evaluateModel(vec_math.VectorG, vec_math.VectorG).


Nested Class Summary
(package private) static class AbstractMultidimensionalDataModel.LocalMM
          A localM-estimate model for the data.
 
Field Summary
protected  VectorG[] sigma
          If applicable, the measurement errors.
protected  VectorG[] x
          The independant variables as an array of vectors.
protected  VectorG[] y
          The measures as an array of doubles.
 
Constructor Summary
protected AbstractMultidimensionalDataModel(VectorG[] times, VectorG[] data, VectorG[] err)
          We construct an abstract data model by providing the dependant variables at the measurement points.
 
Method Summary
 int dimension()
          Returns the dimension of the measure.
 boolean equalData(MultidimensionalDataModel mdm)
          Two data model have the same data base, if their data are equal.
private static double finalSize(Amoeba a)
          Estimate the final size of the simplex.
private static double finalSpread(Amoeba a)
          Estimate the final size of the simplex.
 Multidimensional getChiSquareModel()
          We return a multidimensional that calculated the chi-square of the model to the data given.
static Multidimensional getChiSquareModel(MultidimensionalDataModel fit)
          We return a multidimensional that calculate the chi-square of the model to the data model given.
static Multidimensional getLorentzianModel(MultidimensionalDataModel fit)
          We return a multidimensional that calculate the model parameters with errors that are Lorentzian.
 int getMeasureCount()
          The number of data points is equal to the array size of the dependant variable array.
 VectorG[] getMeasurementErrors()
          Default implementation returns the total errors here.
 VectorG[] getMeasures()
          Returns the measures as an VectorG.
 VectorG[] getModel(VectorG a)
          Returns the entire model by stepping through all measurement times.
static VectorG[] getModel(VectorG a, MultidimensionalDataModel dm)
          Static version.
 VectorG[] getResiduals(VectorG a)
          Returns the residuals of the measures to the data model.
static VectorG[] getResiduals(VectorG a, MultidimensionalDataModel dm)
          Returns the residuals of the measures to the data model.
static Multidimensional getRobustModel(MultidimensionalDataModel fit)
          We return a multidimensional that calculate the model parameters with errors that are double-sided exponential, which gives a minimization to absolut divergence instead of least-squares.
 VectorG[] getTimes()
          Returns the times the measurements were taken.
 VectorG[] getTotalErrors()
          If the errors were set, we return the error vector here.
static VectorG simplexChiSquareSolve(MultidimensionalDataModel exp, VectorG start, VectorG length)
          We use a Simplex in standard form to solve for a minimum model.
static VectorG simplexChiSquareSolve(MultidimensionalDataModel exp, VectorG start, VectorG length, double tolerance)
          We use a Simplex in standard form to solve for a minimum model.
static VectorG simplexLorentzSolve(MultidimensionalDataModel exp, VectorG start, VectorG length)
          We use a Simplex in lorentzian (even slower than robust) form to solve for a minimum model.
static VectorG simplexLorentzSolve(MultidimensionalDataModel exp, VectorG start, VectorG length, double tolerance)
          We use a Simplex in lorentzian (even slower than robust) form to solve for a minimum model.
static VectorG simplexRobustSolve(MultidimensionalDataModel exp, VectorG start, VectorG length)
          We use a Simplex in robust form to solve for a minimum model.
static VectorG simplexRobustSolve(MultidimensionalDataModel exp, VectorG start, VectorG length, double tolerance)
          We use a Simplex in robust form to solve for a minimum model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface vec_math.MultidimensionalDataModel
evaluateModel, getParameterCount
 

Field Detail

x

protected VectorG[] x
The independant variables as an array of vectors.


y

protected VectorG[] y
The measures as an array of doubles.


sigma

protected VectorG[] sigma
If applicable, the measurement errors.

Constructor Detail

AbstractMultidimensionalDataModel

protected AbstractMultidimensionalDataModel(VectorG[] times,
                                            VectorG[] data,
                                            VectorG[] err)
We construct an abstract data model by providing the dependant variables at the measurement points.

Throws:
NullPointerException - If x is null.
Method Detail

getTimes

public VectorG[] getTimes()
Returns the times the measurements were taken.

Specified by:
getTimes in interface MultidimensionalDataModel
Returns:
An array of dimension MultidimensionalDataModel.getMeasureCount().

getMeasures

public VectorG[] getMeasures()
Returns the measures as an VectorG.

Specified by:
getMeasures in interface MultidimensionalDataModel

getTotalErrors

public VectorG[] getTotalErrors()
If the errors were set, we return the error vector here.

Specified by:
getTotalErrors in interface MultidimensionalDataModel

getMeasurementErrors

public VectorG[] getMeasurementErrors()
Default implementation returns the total errors here.

Specified by:
getMeasurementErrors in interface MultidimensionalDataModel

getModel

public VectorG[] getModel(VectorG a)
Returns the entire model by stepping through all measurement times.

Specified by:
getModel in interface MultidimensionalDataModel
Parameters:
a - The model parameters
Returns:
A model for the data points depending on the model parameters.

getModel

public static VectorG[] getModel(VectorG a,
                                 MultidimensionalDataModel dm)
Static version.


getResiduals

public VectorG[] getResiduals(VectorG a)
Returns the residuals of the measures to the data model. This equals calling getMeasures() and getModel(vec_math.VectorG) and returning the difference between both.

Specified by:
getResiduals in interface MultidimensionalDataModel
Parameters:
a - The model parameters, not necessarily the best fit.

getResiduals

public static VectorG[] getResiduals(VectorG a,
                                     MultidimensionalDataModel dm)
Returns the residuals of the measures to the data model. This equals calling getMeasures() and getModel(vec_math.VectorG) and returning the difference between both.

Parameters:
a - The model parameters, not necessarily the best fit.

getMeasureCount

public int getMeasureCount()
The number of data points is equal to the array size of the dependant variable array.

Specified by:
getMeasureCount in interface MultidimensionalDataModel
Returns:
The number of measurements in the data model. This equals the dimension of the return vector in MultidimensionalDataModel.getModel(vec_math.VectorG).

dimension

public int dimension()
Returns the dimension of the measure.

Specified by:
dimension in interface MultidimensionalDataModel

equalData

public boolean equalData(MultidimensionalDataModel mdm)
Two data model have the same data base, if their data are equal. To allow for random order in the data, we compare the x and y vectors individually for equal data, which is not totally correct, as one had to create a new vector holding x and y simultaneouisly and then compare that for equal data.


getChiSquareModel

public Multidimensional getChiSquareModel()
We return a multidimensional that calculated the chi-square of the model to the data given.


getChiSquareModel

public static Multidimensional getChiSquareModel(MultidimensionalDataModel fit)
We return a multidimensional that calculate the chi-square of the model to the data model given. Use this in an Amoeba to solve for the model parameters.


getRobustModel

public static Multidimensional getRobustModel(MultidimensionalDataModel fit)
We return a multidimensional that calculate the model parameters with errors that are double-sided exponential, which gives a minimization to absolut divergence instead of least-squares. This technique is more robust than least-squares, but can only be used with an Amoeba because of the discontinuety in abs.


getLorentzianModel

public static Multidimensional getLorentzianModel(MultidimensionalDataModel fit)
We return a multidimensional that calculate the model parameters with errors that are Lorentzian. This is a very robust method, as outliers are ignored. It can only be used with an Amoeba because of the strong poles.


finalSize

private static final double finalSize(Amoeba a)
Estimate the final size of the simplex.


finalSpread

private static final double finalSpread(Amoeba a)
Estimate the final size of the simplex.


simplexChiSquareSolve

public static VectorG simplexChiSquareSolve(MultidimensionalDataModel exp,
                                            VectorG start,
                                            VectorG length)
We use a Simplex in standard form to solve for a minimum model.


simplexChiSquareSolve

public static VectorG simplexChiSquareSolve(MultidimensionalDataModel exp,
                                            VectorG start,
                                            VectorG length,
                                            double tolerance)
We use a Simplex in standard form to solve for a minimum model.


simplexRobustSolve

public static VectorG simplexRobustSolve(MultidimensionalDataModel exp,
                                         VectorG start,
                                         VectorG length)
We use a Simplex in robust form to solve for a minimum model.


simplexRobustSolve

public static VectorG simplexRobustSolve(MultidimensionalDataModel exp,
                                         VectorG start,
                                         VectorG length,
                                         double tolerance)
We use a Simplex in robust form to solve for a minimum model.


simplexLorentzSolve

public static VectorG simplexLorentzSolve(MultidimensionalDataModel exp,
                                          VectorG start,
                                          VectorG length)
We use a Simplex in lorentzian (even slower than robust) form to solve for a minimum model.


simplexLorentzSolve

public static VectorG simplexLorentzSolve(MultidimensionalDataModel exp,
                                          VectorG start,
                                          VectorG length,
                                          double tolerance)
We use a Simplex in lorentzian (even slower than robust) form to solve for a minimum model.