I am a quant newbie trying to compute regression coefficients using apache common math libraries in Java. I am trying to use OLSMultipleLinearRegression class to estimate the regression coefficients and residuals for a multiple linear regression model which defines a regressand y which is a [nX1] state vector. The observations or regressors are defined by a state vector x which is again a [nX1] state vector. A test with sample data looks as follows:
//n=3
double[][] y = new double[][]{{-0.03125,0.0078125,0.0.0.0,0.015625},
{-0.03125,0.0078125,0.0.0.0,0.015625},
{-0.03125,0.0078125,0.0.0.0,0.015625}};
//n=3
double[][] x = new double[][]{{+0.03195,-0.005812,0.0.0.0,0.015925},
{-0.03125,0.0079125,0.0.0.0,0.025625},
{-0.03195,0.0078825,0.0.0.0,-0.015625}};
OLSMultipleLinearRegression r = new OLSMultipleLinearRegression()
r.setNoIntercept(true)
r.newSampleData(y,x) //compiler error.
The regressor x is composed of 5 independent state variables which is captured at a given time t. The multiple regression model will attempt to predict a state y or the regressand at t+1 using the regression co-efficients which I am trying to determine using historical data as shown above.
How do I input data of this nature to the model? Apologies in advance if any of this sounds trivial or obvious to you but any help would be much appreciated.