Dear All,

I am a new LAPACK user and I would like to

do a Multiple linear Regression. However I am

not sure which routines (or driver) to use.

Does anybody have something on this line,

or can help me?

Thank you,

Luciano

5 posts
• Page **1** of **1**

Dear All,

I am a new LAPACK user and I would like to

do a Multiple linear Regression. However I am

not sure which routines (or driver) to use.

Does anybody have something on this line,

or can help me?

Thank you,

Luciano

I am a new LAPACK user and I would like to

do a Multiple linear Regression. However I am

not sure which routines (or driver) to use.

Does anybody have something on this line,

or can help me?

Thank you,

Luciano

- wd20lp
**Posts:**7**Joined:**Thu Jun 09, 2005 8:24 am

Given A, an m-by-n matrix with m >=n, and B a vector of size m, the routine DGELS (or S/D/C/Z-GELS) solves the least squares problem

minimize || B - A*X ||_2 over all vector X of size n.

(see http://www.netlib.org/lapack/double/dgels.f.)

Multiple linear regression problems end up with a linear least squares problem so you can use LAPACK routine DGELS to eventually solve your problem.

Note that you are responsible for constructing the matrix A and B.

For example, if you simply want to solve the multiple linear regression problem

Y = a + b1*X1 + b2*X2 + ... + bp*Xp

then you set

A = [ ones, X1, X2, ... Xp ] , where A is a m-by-(p+1) matrix, ones is the vector of m ones, each column j of A represents the values of the variable Xj at the m different points

B = Y, B is a vector of size m with the values of the variable Y at the m different points

DGELS returns you the vector X of size (p+1) with the regression coefficient:

X = [ a, b1, b2, ... bp ] (in a column not in a line as written).

minimize || B - A*X ||_2 over all vector X of size n.

(see http://www.netlib.org/lapack/double/dgels.f.)

Multiple linear regression problems end up with a linear least squares problem so you can use LAPACK routine DGELS to eventually solve your problem.

Note that you are responsible for constructing the matrix A and B.

For example, if you simply want to solve the multiple linear regression problem

Y = a + b1*X1 + b2*X2 + ... + bp*Xp

then you set

A = [ ones, X1, X2, ... Xp ] , where A is a m-by-(p+1) matrix, ones is the vector of m ones, each column j of A represents the values of the variable Xj at the m different points

B = Y, B is a vector of size m with the values of the variable Y at the m different points

DGELS returns you the vector X of size (p+1) with the regression coefficient:

X = [ a, b1, b2, ... bp ] (in a column not in a line as written).

- Julien Langou
**Posts:**828**Joined:**Thu Dec 09, 2004 12:32 pm**Location:**Denver, CO, USA

Hi Malcom

Apparently is working. I haven't tested extensivelly. However

any comment is welcome. Actually if you have suggestions

about implementation of any complementary statistics calculation

for Muliple Linear Regression it will be usefull (e.g., confidence intervals, etc...)

Cheers,

Luciano

Apparently is working. I haven't tested extensivelly. However

any comment is welcome. Actually if you have suggestions

about implementation of any complementary statistics calculation

for Muliple Linear Regression it will be usefull (e.g., confidence intervals, etc...)

Cheers,

Luciano

- wd20lp
**Posts:**7**Joined:**Thu Jun 09, 2005 8:24 am

5 posts
• Page **1** of **1**

Users browsing this forum: No registered users and 1 guest