org.jscience.mathematics.analysis.estimation
Class WeightedMeasurement

java.lang.Object
  extended by org.jscience.mathematics.analysis.estimation.WeightedMeasurement
Direct Known Subclasses:
AbstractCurveFitter.FitMeasurement

public abstract class WeightedMeasurement
extends java.lang.Object

This class represents measurements in estimation problems.

This abstract class implements all the methods needed to handle measurements in a general way. It defines neither the getTheoreticalValue nor the getPartial methods, which should be defined by sub-classes according to the specific problem.

The getTheoreticalValue and getPartial methods should always use the current estimate of the parameters set by the solver in the problem. These parameters can be retrieved through the EstimationProblem.getAllParameters method if the measurements are independant of the problem, or directly if they are implemented as inner classes of the problem.

The instances for which the ignored flag is set through the setIgnored method are ignored by the solvers. This can be used to reject wrong measurements at some steps of the estimation.

See Also:
EstimationProblem

Constructor Summary
WeightedMeasurement(double weight, double measuredValue)
          Simple constructor.
WeightedMeasurement(double weight, double measuredValue, boolean ignored)
          Simple constructor.
 
Method Summary
 double getMeasuredValue()
          Get the measured value
abstract  double getPartial(EstimatedParameter parameter)
          Get the partial derivative of the measurement according to the parameter.
 double getResidual()
          Get the residual for this measurement The residual is the measured value minus the theoretical value.
abstract  double getTheoreticalValue()
          Get the theoretical value expected for this measurement The theoretical value is the value expected for this measurement if the model and its parameter were all perfectly known.
 double getWeight()
          Get the weight of the measurement in the least squares problem
 boolean isIgnored()
          Check if this measurement should be ignored
 void setIgnored(boolean ignored)
          Set the ignore flag to the specified value Setting the ignore flag to true allow to reject wrong measurements, which sometimes can be detected only rather late.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WeightedMeasurement

public WeightedMeasurement(double weight,
                           double measuredValue)
Simple constructor. Build a measurement with the given parameters, and set its ignore flag to false.

Parameters:
weight - weight of the measurement in the least squares problem
measuredValue - measured value

WeightedMeasurement

public WeightedMeasurement(double weight,
                           double measuredValue,
                           boolean ignored)
Simple constructor. Build a measurement with the given parameters

Parameters:
weight - weight of the measurement in the least squares problem
measuredValue - measured value
ignored - true if the measurement should be ignored
Method Detail

getWeight

public double getWeight()
Get the weight of the measurement in the least squares problem

Returns:
weight

getMeasuredValue

public double getMeasuredValue()
Get the measured value

Returns:
measured value

getTheoreticalValue

public abstract double getTheoreticalValue()
Get the theoretical value expected for this measurement The theoretical value is the value expected for this measurement if the model and its parameter were all perfectly known.

Returns:
theoretical value

getResidual

public double getResidual()
Get the residual for this measurement The residual is the measured value minus the theoretical value.

Returns:
residual

getPartial

public abstract double getPartial(EstimatedParameter parameter)
Get the partial derivative of the measurement according to the parameter.

Parameters:
parameter - parameter against which the partial derivative should be computed
Returns:
partial derivative

setIgnored

public void setIgnored(boolean ignored)
Set the ignore flag to the specified value Setting the ignore flag to true allow to reject wrong measurements, which sometimes can be detected only rather late.

Parameters:
ignored - value for the ignore flag

isIgnored

public boolean isIgnored()
Check if this measurement should be ignored

Returns:
true if the measurement should be ignored