Multiple linear regression

I am trying to use GLSMultipleLinearRegression (from apas commons-math package) for multiple linear regression. The covariance matrix is ​​expected to be input — I'm not sure how to compute them. I have one array of dependent variables and 3 arrays of independent variables.
Any idea how to calculate the covariance matrix?

Note. I have 200 elements for each of the three independent variables

Thanks
Bharani

+3
source share
7 answers

, . , . GLS . GLS , . (.pdf ) , , , GLS.

+4

Flanagan, . , math. FGLS -

-Bharani

+2

?

new Covariance().computeCovarianceMatrix(data)

, , 3 , 1 200 . , 4 200 . ( , , ):

double [] data = new double [4][];
data[0] = new double[]{y[0], x[0][0], x[1][0], x[2][0]};
data[1] = new double[]{y[1], x[0][1], x[1][1], x[2][1]};
data[2] = new double[]{y[2], x[0][2], x[1][2], x[2][2]};
// ... etc.
data[199] = new double[]{y[199], x[0][199], x[1][199], x[2][199]};
Covariance covariance = new Covariance().computeCovarianceMatrix(data);
double [][] omega = covariance.getCovarianceMatrix().getData();

, :

MultipleLinearRegression regression = new GLSMultipleLinearRegression();
// Assumes you put your independent variables in x and dependent in y
// Also assumes that you made your covariance matrix as shown above 
regression.addData(y, x, omega); // we do need covariance
+1

, Ordinary Least Squares (OLS) (GLS). , . , , OLS OLSMultipleLinearRegression.

+1

@

,

Im . , 1- . ?

0

3 : x1, x2, x3 (N), (M). MxN.

, Apache, : Covariance.computeCovarianceMatrix( RealMatrix).

0

? , , ( ) GLSMultipleLinearRegression

0

Source: https://habr.com/ru/post/1716294/


All Articles