org.akutan.utilities
Class LeastSquares

java.lang.Object
  extended by org.akutan.utilities.LeastSquares

public class LeastSquares
extends java.lang.Object

Simple class to hold algorithm for least squares fit

Since:
10 March 2007

Constructor Summary
LeastSquares()
           
 
Method Summary
static double leastSquares(cern.colt.matrix.DoubleMatrix1D asset, cern.colt.matrix.DoubleMatrix1D factors)
          Performs a least squares fit to the data.
static cern.colt.matrix.DoubleMatrix1D leastSquares(cern.colt.matrix.DoubleMatrix1D asset, cern.colt.matrix.DoubleMatrix2D factors)
          Performs a least squares fit to the data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LeastSquares

public LeastSquares()
Method Detail

leastSquares

public static double leastSquares(cern.colt.matrix.DoubleMatrix1D asset,
                                  cern.colt.matrix.DoubleMatrix1D factors)
Performs a least squares fit to the data. This is very basic.

Parameters:
asset - Vector of asset returns Tx1
factors - Matrix of factor returns TxN
Returns:
Vector of factor weights Nx1

leastSquares

public static cern.colt.matrix.DoubleMatrix1D leastSquares(cern.colt.matrix.DoubleMatrix1D asset,
                                                           cern.colt.matrix.DoubleMatrix2D factors)
Performs a least squares fit to the data. This is very basic.

Parameters:
asset - Vector of asset returns Tx1
factors - Matrix of factor returns TxN
Returns:
Vector of factor weights Nx1