|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rit.numeric.RobustFit
public class RobustFit
Class RobustFit uses a robust estimation procedure to fit a series of (x,y) data points to a model. The data series is an instance of class XYSeries. The model is represented by a ParameterizedFunction that computes the y value, given an x value. The model also has parameters.
Given a data series, a model function, and an initial guess for the parameter values, class RobustFit's fit() method finds parameter values that minimize the following metric:
Σi ρ (yi − f (xi, parameters))
where f is the model function and ρ is one of these metric functions:
In other words, the fit() method fits the model to the data by adjusting the parameters to minimize the metric.
The metric function is the negative logarithm of the probability distribution of the errors in the y values. The above metric functions correspond to normal, two-sided exponential, and Cauchy error distributions.
The metric functions differ in how they treat outliers, i.e., data points that deviate from the model. The normal metric function gives increasing weights to points with increasing deviations. However, because of the increasing weights, outlier points may skew the fit (hence, this is not really a "robust" metric function). The exponential metric function gives equal weights to all points, regardless of deviation. This reduces the influence of outliers on the fit, yielding a more robust fit. With the Cauchy metric function, the weights first increase, then decrease as the deviations increase. This reduces the influence of outliers even further.
The fit() method uses class MDMinimizationDownhillSimplex to find the parameter values that minimize the metric. The inputs to and outputs from the fit() method are stored in fields of an instance of class RobustFit.
The fitWithDistribution() method uses the bootstrapping technique to determine the distribution of the model parameters, which depends on the error distribution of the data points. Bootstrapping performs multiple iterations of the model fitting procedure. On each iteration, a trial data set the same size as the original data set is created by sampling the original data points with replacement, and model parameters for the trial data set are computed. The fitWithDistribution() method outputs a series of the parameter values found at each iteration; the confidence region for the parameters; and the goodness-of-fit p-value.
| Field Summary | |
|---|---|
static Function |
CAUCHY
The Cauchy metric function. |
double[] |
confidenceRegionLowerBound
The lower bound of the confidence region for the model parameters. |
double[] |
confidenceRegionUpperBound
The upper bound of the confidence region for the model parameters. |
XYSeries |
data
The data series. |
static Function |
EXPONENTIAL
The exponential metric function. |
int |
M
The number of parameters in the model, M. |
Function |
metric
The metric function. |
double[] |
metricSeries
The metric values for the model parameter distribution. |
double |
metricValue
The metric value. |
ParameterizedFunction |
model
The model function. |
static Function |
NORMAL
The normal metric function. |
double[] |
param
The model parameters. |
double[][] |
paramSeries
The model parameter distribution. |
double |
pValue
The goodness-of-fit p-value. |
| Constructor Summary | |
|---|---|
RobustFit(ParameterizedFunction model)
Construct a new robust fitting object for the given model. |
|
| Method Summary | |
|---|---|
void |
fit(XYSeries data)
Fit the given data series to the model. |
void |
fitWithDistribution(XYSeries data,
int T,
Random prng,
double conf)
Fit the given data series to the model and compute the distribution of the model parameters. |
protected void |
initializeSimplex(MDMinimizationDownhillSimplex minimizer)
Initialize the simplex in the given downhill simplex minimizer object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final ParameterizedFunction model
public final int M
public Function metric
public final double[] param
public XYSeries data
public double metricValue
public double[][] paramSeries
public double[] metricSeries
public double[] confidenceRegionLowerBound
public double[] confidenceRegionUpperBound
public double pValue
public static final Function NORMAL
public static final Function EXPONENTIAL
public static final Function CAUCHY
| Constructor Detail |
|---|
public RobustFit(ParameterizedFunction model)
model - Model function.
NullPointerException - (unchecked exception) Thrown if model is null.| Method Detail |
|---|
public void fit(XYSeries data)
The fit() method uses the downhill simplex technique to find the model parameters that minimize the metric. This involves initializing the simplex in an MDMinimizationDownhillSimplex object. The initializeSimplex() method is called to initialize the simplex.
data - Data series.
TooManyIterationsException - (unchecked exception) Thrown if too many iterations occurred without
finding parameters that minimize the metric function.
public void fitWithDistribution(XYSeries data,
int T,
Random prng,
double conf)
The fitWithDistribution() method uses the downhill simplex technique to find the model parameters that minimize the metric. This involves initializing the simplex in an MDMinimizationDownhillSimplex object. The initializeSimplex() method is called to initialize the simplex.
data - Data series.T - Number of trials.prng - Pseudorandom number generator.conf - Confidence level, in the range 0.0 .. 1.0.
IllegalArgumentException - (unchecked exception) Thrown if conf is out of bounds.
TooManyIterationsException - (unchecked exception) Thrown if too many iterations occurred without
finding parameters that minimize the metric function.protected void initializeSimplex(MDMinimizationDownhillSimplex minimizer)
The default implementation of this method sets the first simplex point to param, sets the second simplex point to param except element 0 is set to perturb(param[0]), sets the third simplex point to param except element 1 is set to perturb(param[1]), and so on. perturb(x) = 1.01x if x ≠ 0; perturb(0) = 0.01. This method can be overridden to initialize the simplex differently.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||