vec_math
Class AbstractDataModel

java.lang.Object
  extended by vec_math.AbstractDataModel
All Implemented Interfaces:
DataModel
Direct Known Subclasses:
AbstractGradientModel, PhaseRegression.PhaseModel

public abstract class AbstractDataModel
extends Object
implements DataModel

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 DataModel.getParameterCount() and DataModel.evaluateModel(vec_math.VectorG, vec_math.VectorG).


Nested Class Summary
static class AbstractDataModel.Construct
          Just to see the signature of the constructor.
(package private) static class AbstractDataModel.LocalM
          A localM-estimate model for the data.
 
Field Summary
protected  double[] sigma
          If applicable, the measurement errors.
protected  VectorG[] x
          The independant variables as an array of vectors.
protected  double[] y
          The measures as an array of doubles.
 
Constructor Summary
protected AbstractDataModel(VectorG[] times, double[] data, double[] err)
          We construct an abstract data model by providing the dependant variables at the measurement points.
 
Method Summary
 Multidimensional getChiSquareModel()
          We return a multidimensional that calculated the chi-square of the model to the data given.
static Multidimensional getChiSquareModel(DataModel fit)
          We return a multidimensional that calculate the chi-square of the model to the data model given.
static Multidimensional getLorentzianModel(DataModel 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.
 double[] getMeasurementErrors()
          Default implementation returns the total errors here.
 double[] getMeasures()
          Returns the measures as an VectorG.
 double[] getModel(VectorG a)
          Returns the entire model by stepping through all measurement times.
static double[] getModel(VectorG a, DataModel dm)
          Static version.
 double[] getResiduals(VectorG a)
          Returns the residuals of the measures to the data model.
static double[] getResiduals(VectorG a, DataModel dm)
          Returns the residuals of the measures to the data model.
static double getRms(VectorG a, DataModel dm)
          Return the rott of the average of the residuals squared.
static Multidimensional getRobustModel(DataModel 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.
 double[] getTotalErrors()
          If the errors were set, we return the error vector here.
static VectorG LorentzianSolver(DataModel exp, VectorG start, VectorG length)
          We use a Simplex in robust form to solve for a minimum model.
static VectorG RobustSolver(DataModel exp, VectorG start, VectorG length)
          We use a Simplex in robust form to solve for a minimum model.
static VectorG SimplexSolver(DataModel exp, VectorG start, VectorG length)
          We use a Simplex in standard 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.DataModel
evaluateModel, getParameterCount
 

Field Detail

x

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


y

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


sigma

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

Constructor Detail

AbstractDataModel

protected AbstractDataModel(VectorG[] times,
                            double[] data,
                            double[] 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 DataModel
Returns:
An array of dimension DataModel.getMeasureCount().

getMeasures

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

Specified by:
getMeasures in interface DataModel

getTotalErrors

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

Specified by:
getTotalErrors in interface DataModel

getMeasurementErrors

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

Specified by:
getMeasurementErrors in interface DataModel

getModel

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

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

getModel

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


getResiduals

public double[] 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 DataModel
Parameters:
a - The model parameters, not necessarily the best fit.

getResiduals

public static double[] getResiduals(VectorG a,
                                    DataModel 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.

getRms

public static double getRms(VectorG a,
                            DataModel dm)
Return the rott of the average of the residuals squared.


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 DataModel
Returns:
The number of measurements in the data model. This equals the dimension of the return vector in DataModel.getModel(vec_math.VectorG).

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(DataModel 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(DataModel 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(DataModel 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.


SimplexSolver

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


RobustSolver

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


LorentzianSolver

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