public void multipleLinearRegression(String fileName,int indVariable,int[] c,String[] factors,boolean interceptTerm,int rowIni,int rowEnd){
  try {
    BufferedReader reader=new BufferedReader(new FileReader(fileName));
    Matrix data=Matrix.read(reader);
    reader.close();
    int rows=data.getRowDimension() - 1;
    int cols=data.getColumnDimension() - 1;
    if (rowIni < 0 || rowIni > rows)     throw new RuntimeException("Problem reading file, rowIni=" + rowIni + "  and number of rows in file="+ rows);
    if (rowEnd < 0 || rowEnd > rows)     throw new RuntimeException("Problem reading file, rowIni=" + rowIni + "  and number of rows in file="+ rows);
    if (rowIni > rowEnd)     throw new RuntimeException("Problem reading file, rowIni < rowend" + rowIni + " < "+ rowEnd);
    Matrix indVar=data.getMatrix(rowIni,rowEnd,indVariable,indVariable);
    data=data.getMatrix(rowIni,rowEnd,c);
    multipleLinearRegression(indVar,data,interceptTerm);
  }
 catch (  Exception e) {
    throw new RuntimeException("Problem reading file " + fileName,e);
  }
}

public void multipleLinearRegression ( String fileName , int indVariable , int [ ] c , String [ ] factors , boolean interceptTerm , int rowIni , int rowEnd ) { try { BufferedReader reader = new BufferedReader ( new FileReader ( fileName ) ) ; Matrix data = Matrix . read ( reader ) ; reader . close ( ) ; int rows = data . getRowDimension ( ) - 1 ; int cols = data . getColumnDimension ( ) - 1 ; if ( rowIni < 0 || rowIni > rows ) throw new RuntimeException ( "Problem reading file, rowIni=" + rowIni + "  and number of rows in file=" + rows ) ; if ( rowEnd < 0 || rowEnd > rows ) throw new RuntimeException ( "Problem reading file, rowIni=" + rowIni + "  and number of rows in file=" + rows ) ; if ( rowIni > rowEnd ) throw new RuntimeException ( "Problem reading file, rowIni < rowend" + rowIni + " < " + rowEnd ) ; Matrix indVar = data . getMatrix ( rowIni , rowEnd , indVariable , indVariable ) ; data = data . getMatrix ( rowIni , rowEnd , c ) ; multipleLinearRegression ( indVar , data , interceptTerm ) ; } catch ( Exception e ) { throw new RuntimeException ( "Problem reading file " + fileName , e ) ; } }
multiplelinearregression providing index numbers for the columns in filename , index 0 correspond to column 1
