commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Sadowski <>
Subject Re: [math] Updating Regression questions..
Date Sat, 10 Sep 2011 18:14:36 GMT

> Another mostly exceptional question from me! In the
> interface UpdatingMultipleLinearRegression, we have regress() and
> regress(int[] variablesToInclude).
> 1. What is the appropriate exception to throw when there is a variable index
> in the array which does not exist in the data? For example I have regressors
> 0 to 4. The user requests variables 0, 2 and 7. Is it still a
> ModelSpecificationException? If so what is appropriate text? "Request for
> index {0} cannot be fulfilled because the data has only {1} independent
> variables"

Maybe "OutOfRangeException".

> 2. Say that the request list ( the integer array variablesToInclude ) has a
> request that looks like int[]{ 1, 4, 2  }. In the Miller regression, I
> attempt to return things in the canonical order. Would it make better sense
> to have an element in the RegressionResults object which records the
> canonical position of the regressor and returns the result in arbitrary
> order?

It could be a precondition that the array be sorted in increasing order.
There is a utility to check this in "MathUtils" (but only for "double[]").

> 3. In the call to regress() what is the proper manner in which to handle a
> case where no result can be returned? Say that the user has supplied nothing
> but NaNs in the data. There is nothing that can be done. What is the proper
> exception? Is it fair to return just a null?

Maybe "NoDataException".

> 4. Should any of these regression techniques (whether they implement
> UpdatingMultipleRegression or not) check the (input) data for things like
> NaN or Inf? If so, what is the exception to throw? Is there any other
> parallel with other classes in Math?

If non finite input does not make sense, you could pass it first to one of
the "checkFinite" method in "MathUtils".


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message