Inger, Matthew napisał(a):

> returning a RealMatrix for the coefficients doesn't make sense
> to me, since a matrix implies N x M dimensions, and the coefficient
> matrix has a fixed number of rows (1).  I'd rather return an double[]
> instance.  However, that array is available through LinearFunction
> as i have outlined it below, so it's not really hard to get to it:
> 
> results.getFuntion().getCoefficients();

This way of obtaining coefficients might be natural and elegant
for a Java programmer, but I think that average statistician would
prefere to get them in a simpler way, without digging through
interfaces, methods, etc. just to find such a basic result.

As I understand rationale behind returning RealMatrix is that
there is a number of usefull methods that makes manipulation
with the result easier, but I would not complain if I get double[],
I would not have to think about some additional interface (RealMatrix).
In addition double[] can be easily converted to RealMatrix if it is needed.

Piotr


> 
> -----Original Message-----
> From: Phil Steitz [mailto:[EMAIL PROTECTED]
> Sent: Monday, January 26, 2004 4:59 PM
> To: Jakarta Commons Developers List
> Subject: RE: [math] - Multiple Linear Regression
> 
> 
> --- "Inger, Matthew" <[EMAIL PROTECTED]> wrote:
> > Is there any plan to possibly have a MultivariateRealFunction interface?
> > I had planned to return the linear regression coefficients in
> > the form of a linear function:
> > 
> > public interface MultivariateRealFunction
> > {
> >     public double value(double x[]);
> > }
> > 
> > // in package "linear"
> > 
> > // a function of the form:
> > //    y = b0 + b1*x1 + b2*x2 + ... bn*xn
> > public class LinearFunction 
> >     implements MultivariateRealFunction
> > {
> >     public double value(double x[]) { ... };
> >     public int getCoefficientCount() { ... };
> >     public double getCoefficientAt(int idx) { ... };
> >     public double[] getCoefficients() { ... };
> > }
> > 
> > 
> > public class LinearRegressionResults
> > {
> >    public LinearFunction getFunction() { ... };
> >    public double[] getResidual();
> >    ...
> >    // put in all the other statistical values here
> > }
> > 
> > public class LinearRegresion
> > {
> >    public LinearRegressionResults 
> >           solve(double x[][], double y[]) { ... };
> > }
> > 
> > Thoughts?
> > 
> That is an interesting approach, but I suspect that users of this class are
> going to be primarily interested in the vector of estimated coefficients as
> well as standard errors and other model statistics.  I would prioritize
> getting the parameter estimates and standard errors represented and
> available.  I have no problem including a predict() method (or even
> returning a function) that uses the coefficients to produce predicted
> values based on the model, but I would be happy (actually happier) with a
> (row) RealMatrix of coefficients.  
> 
> Phil
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free web site building tool. Try it!
> http://webhosting.yahoo.com/ps/sb/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to