Thread Subject:
Multiple regression

Subject: Multiple regression

From: Shariful

Date: 7 Aug, 2012 10:42:14

Message: 1 of 14

Dear Matlab Community,
I would like to use Matlab multiple regression function "regress (y, X)". But I have a little
problem. I have 3 predictor vectors x1, x2, x3 of different length. How can I use them to build
X?

Thanks in advance for your help!
Shariful

Subject: Multiple regression

From: Torsten

Date: 7 Aug, 2012 11:23:53

Message: 2 of 14

On 7 Aug., 12:42, "Shariful " <endrom...@gmail.com> wrote:
> Dear Matlab Community,
> I would like to use Matlab multiple regression function "regress (y, X)". But I have a little
> problem. I have 3 predictor vectors x1, x2, x3 of different length. How can I use them to build
> X?
>
> Thanks in advance for your help!
> Shariful

Row j of the matrix X consist of the three predictor values [x1_i1
x2_i2 x3_i3] (taken from your three
predictor vectors x1, x2 and x3, respectively) that are associated
with observation j in the y-vector.

Best wishes
Torsten.

Subject: Multiple regression

From: Shariful

Date: 7 Aug, 2012 12:18:09

Message: 3 of 14

Thanks for your reply. I know that X should be defined as X=[x1 x2 x3]. My question is what should I do if x1, x2 and x3 are of different length? For example,
suppose I have

x1=[1 2 3 4 5];
 x2=[10 20 30 40 50 60];
If I try
>> X=[x1 x2]
I get an error which is expected: ??? Error using ==> horzcat
CAT arguments dimensions are not consistent.

Torsten <Torsten.Hennig@umsicht.fraunhofer.de> wrote in message <322a4998-56bb-43f7-9805-2bf00e34d6e8@j11g2000vbc.googlegroups.com>...
> On 7 Aug., 12:42, "Shariful " <endrom...@gmail.com> wrote:
> > Dear Matlab Community,
> > I would like to use Matlab multiple regression function "regress (y, X)". But I have a little
> > problem. I have 3 predictor vectors x1, x2, x3 of different length. How can I use them to build
> > X?
> >
> > Thanks in advance for your help!
> > Shariful
>
> Row j of the matrix X consist of the three predictor values [x1_i1
> x2_i2 x3_i3] (taken from your three
> predictor vectors x1, x2 and x3, respectively) that are associated
> with observation j in the y-vector.
>
> Best wishes
> Torsten.

Subject: Multiple regression

From: Torsten

Date: 7 Aug, 2012 13:04:49

Message: 4 of 14

On 7 Aug., 14:18, "Shariful " <endrom...@gmail.com> wrote:
> Thanks for your reply. I know that X should be defined as X=[x1 x2 x3]. My question is what should I do if x1, x2 and x3 are of different length? For example,
> suppose I have
>
> x1=[1 2 3 4 5];
> x2=[10 20 30 40 50 60];
> If I try>> X=[x1 x2]
>
> I get an error which is expected: ??? Error using ==> horzcat
> CAT arguments dimensions are not consistent.
>
>
>
> Torsten <Torsten.Hen...@umsicht.fraunhofer.de> wrote in message <322a4998-56bb-43f7-9805-2bf00e34d...@j11g2000vbc.googlegroups.com>...
> > On 7 Aug., 12:42, "Shariful " <endrom...@gmail.com> wrote:
> > > Dear Matlab Community,
> > > I would like to use Matlab multiple regression function "regress (y, X)". But I have a little
> > > problem. I have 3 predictor vectors x1, x2, x3 of different length. How can I use them to build
> > > X?
>
> > > Thanks in advance for your help!
> > > Shariful
>
> > Row j of the matrix X consist of the three predictor values [x1_i1
> > x2_i2 x3_i3] (taken from your three
> > predictor vectors x1, x2 and x3, respectively) that are associated
> > with observation j in the y-vector.
>
> > Best wishes
> > Torsten.- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -

For i=1:I,
  For j=1:J,
    For k=1:K,
       X((i-1)*J*K+(j-1)*K+k,1:3)=[x1(i) x2(j) x3(k)];
    end
  end
end

Best wishes
Torsten.

Subject: Multiple regression

From: Steven_Lord

Date: 7 Aug, 2012 13:25:22

Message: 5 of 14



"Shariful " <endromida@gmail.com> wrote in message
news:jvr121$e8b$1@newscl01ah.mathworks.com...
> Thanks for your reply. I know that X should be defined as X=[x1 x2 x3].
> My question is what should I do if x1, x2 and x3 are of different length?
> For example,
> suppose I have
>
> x1=[1 2 3 4 5];
> x2=[10 20 30 40 50 60];

Do you have 5*6 = 30 data points, one for each combination of values where
one comes from x1 and one from x2? If so, look at MESHGRID.

If that's not your situation, you will need to say more about how you intend
to do a regression for a function y = f(X) where the function sometimes
accepts one input and sometimes two.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Multiple regression

From: dpb

Date: 7 Aug, 2012 13:28:11

Message: 6 of 14

On 8/7/2012 7:18 AM, Shariful wrote:

...[top posting repaired--don't do that: hard conversation follow makes]...

> Torsten <Torsten.Hennig@umsicht.fraunhofer.de> wrote in message
> <322a4998-56bb-43f7-9805-2bf00e34d6e8@j11g2000vbc.googlegroups.com>...
>> On 7 Aug., 12:42, "Shariful " <endrom...@gmail.com> wrote:
...
>> > I would like to use Matlab multiple regression function "regress (y,
>> > X)". But I have a little problem. I have 3 predictor vectors x1,
>> > x2, x3 of different length. >> How can I use them to build
>> > X?
...
>> Row j of the matrix X consist of the three predictor values [x1_i1
>> x2_i2 x3_i3] (taken from your three
>> predictor vectors x1, x2 and x3, respectively) that are associated
>> with observation j in the y-vector.
...

...
 > My question is what should I do if x1, x2 and x3 are of different
 > length? For example,
 > suppose I have
 >
 > x1=[1 2 3 4 5];
 > x2=[10 20 30 40 50 60];
 > If I try
 >>> X=[x1 x2]
 > I get an error which is expected: ??? Error using ==> horzcat
 > CAT arguments dimensions are not consistent.

????

 >> x1=[1 2 3 4 5]; x2=[10 20 30 40 50 60];
 >> X=[x1 x2];
 >>

You mean you have

x1=[1 2 3 4 5]'; x2=[10 20 30 40 50 60]';

instead, I presume?

If indeed you have column vectors you need to concatenate in that
direction instead of horizontally...

 >> x1=[1 2 3 4 5]'; x2=[10 20 30 40 50 60]';
 >> X=[x1; x2];
 >> whos x*
   Name Size Bytes Class

   x1 5x1 40 double array
   x2 6x1 48 double array
   X 11x1 88 double array

 >>

Read "Getting Started" section on arrays and matrices...

--

Subject: Multiple regression

From: Shariful

Date: 7 Aug, 2012 13:47:13

Message: 7 of 14

Thanks for your reply. Yes, I mean
x1=[1 2 3 4 5]'; x2=[10 20 30 40 50 60]';

>>If indeed you have column vectors you need to concatenate in that
>>direction instead of horizontally...

 >> x1=[1 2 3 4 5]'; x2=[10 20 30 40 50 60]';
 >> X=[x1; x2];
 >> whos x*
  
--- NO, I do not want that. If I do this, then the 2 predictor (x1 & x2) will be a reduced to single predictor!
 My question was: If I have 3 predictor vectors x1, x2, x3 (each of them are of different lengths). How can I do multiple regression? If I want to use the function "regress" which requires
that X = [ones(size(x1)) x1 x2 x3]. But as my x1, x2 and x3 are of different length, I can not for X! What can I do now? Thanks.


dpb <none@non.net> wrote in message <jvr55g$ep5$1@speranza.aioe.org>...
> On 8/7/2012 7:18 AM, Shariful wrote:
>
> ...[top posting repaired--don't do that: hard conversation follow makes]...
>
> > Torsten <Torsten.Hennig@umsicht.fraunhofer.de> wrote in message
> > <322a4998-56bb-43f7-9805-2bf00e34d6e8@j11g2000vbc.googlegroups.com>...
> >> On 7 Aug., 12:42, "Shariful " <endrom...@gmail.com> wrote:
> ...
> >> > I would like to use Matlab multiple regression function "regress (y,
> >> > X)". But I have a little problem. I have 3 predictor vectors x1,
> >> > x2, x3 of different length. >> How can I use them to build
> >> > X?
> ...
> >> Row j of the matrix X consist of the three predictor values [x1_i1
> >> x2_i2 x3_i3] (taken from your three
> >> predictor vectors x1, x2 and x3, respectively) that are associated
> >> with observation j in the y-vector.
> ...
>
> ...
> > My question is what should I do if x1, x2 and x3 are of different
> > length? For example,
> > suppose I have
> >
> > x1=[1 2 3 4 5];
> > x2=[10 20 30 40 50 60];
> > If I try
> >>> X=[x1 x2]
> > I get an error which is expected: ??? Error using ==> horzcat
> > CAT arguments dimensions are not consistent.
>
> ????
>
> >> x1=[1 2 3 4 5]; x2=[10 20 30 40 50 60];
> >> X=[x1 x2];
> >>
>
> You mean you have
>
> x1=[1 2 3 4 5]'; x2=[10 20 30 40 50 60]';
>
> instead, I presume?
>
> If indeed you have column vectors you need to concatenate in that
> direction instead of horizontally...
>
> >> x1=[1 2 3 4 5]'; x2=[10 20 30 40 50 60]';
> >> X=[x1; x2];
> >> whos x*
> Name Size Bytes Class
>
> x1 5x1 40 double array
> x2 6x1 48 double array
> X 11x1 88 double array
>
> >>
>
> Read "Getting Started" section on arrays and matrices...
>
> --

Subject: Multiple regression

From: Torsten

Date: 7 Aug, 2012 13:55:30

Message: 8 of 14

On 7 Aug., 15:47, "Shariful " <endrom...@gmail.com> wrote:
> Thanks for your reply. Yes, I mean
> x1=[1 2 3 4 5]'; x2=[10 20 30 40 50 60]';
>
> >>If indeed you have column vectors you need to concatenate in that
> >>direction instead of horizontally...
>
> >> x1=[1 2 3 4 5]'; x2=[10 20 30 40 50 60]';
> >> X=[x1; x2];
> >> whos x*
>
> --- NO, I do not want that. If I do this, then the 2 predictor (x1 & x2) will be a reduced to single predictor!
> My question was: If I have 3 predictor vectors x1, x2, x3 (each of them are of different lengths). How can I do multiple regression? If I want to use the function "regress" which requires
> that X = [ones(size(x1)) x1 x2 x3]. But as my x1, x2 and x3 are of different length, I can not for X! What can I do now? Thanks.
>
>
>
> dpb <n...@non.net> wrote in message <jvr55g$ep...@speranza.aioe.org>...
> > On 8/7/2012 7:18 AM, Shariful wrote:
>
> > ...[top posting repaired--don't do that: hard conversation follow makes]...
>
> > > Torsten <Torsten.Hen...@umsicht.fraunhofer.de> wrote in message
> > > <322a4998-56bb-43f7-9805-2bf00e34d...@j11g2000vbc.googlegroups.com>...
> > >> On 7 Aug., 12:42, "Shariful " <endrom...@gmail.com> wrote:
> > ...
> > >> > I would like to use Matlab multiple regression function "regress (y,
> > >> > X)". But I have a little problem. I have 3 predictor vectors x1,
> > >> > x2, x3 of different length. >> How can I use them to build
> > >> > X?
> > ...
> > >> Row j of the matrix X consist of the three predictor values [x1_i1
> > >> x2_i2 x3_i3] (taken from your three
> > >> predictor vectors x1, x2 and x3, respectively) that are associated
> > >> with observation j in the y-vector.
> > ...
>
> > ...
> > > My question is what should I do if x1, x2 and x3 are of different
> > > length? For example,
> > > suppose I have
>
> > > x1=[1 2 3 4 5];
> > > x2=[10 20 30 40 50 60];
> > > If I try
> > >>> X=[x1 x2]
> > > I get an error which is expected: ??? Error using ==> horzcat
> > > CAT arguments dimensions are not consistent.
>
> > ????
>
> > >> x1=[1 2 3 4 5]; x2=[10 20 30 40 50 60];
> > >> X=[x1 x2];
>
> > You mean you have
>
> > x1=[1 2 3 4 5]'; x2=[10 20 30 40 50 60]';
>
> > instead, I presume?
>
> > If indeed you have column vectors you need to concatenate in that
> > direction instead of horizontally...
>
> > >> x1=[1 2 3 4 5]'; x2=[10 20 30 40 50 60]';
> > >> X=[x1; x2];
> > >> whos x*
> > Name Size Bytes Class
>
> > x1 5x1 40 double array
> > x2 6x1 48 double array
> > X 11x1 88 double array
>
> > Read "Getting Started" section on arrays and matrices...
>
> > --- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -

Steven and me already answered your question.

The matrix X must be given as follows:
[x1(1) x2(1);
x1(1) x2(2);
...
x1(1) x2(M);
x1(2) x2(1);
x1(2) x2(2);
...
x1(2) x2(M);
...
x1(M) x2(1);
x1(M) x2(2);
...
x1(M) x2(N)]

This is either accomplished by my 3-fold loop or the MESHGRID-
facility.

If you want to add a constant term in your regression model, the loop
must be
For i=1:I,
  For j=1:J,
    For k=1:K,
       X((i-1)*J*K+(j-1)*K+k,1:4)=[ 1 x1(i) x2(j) x3(k)];
    end
  end
end

Best wishes
Torsten.

Subject: Multiple regression

From: Torsten

Date: 7 Aug, 2012 14:02:26

Message: 9 of 14

On 7 Aug., 15:55, Torsten <Torsten.Hen...@umsicht.fraunhofer.de>
wrote:
> On 7 Aug., 15:47, "Shariful " <endrom...@gmail.com> wrote:
>
>
>
>
>
> > Thanks for your reply. Yes, I mean
> > x1=[1 2 3 4 5]'; x2=[10 20 30 40 50 60]';
>
> > >>If indeed you have column vectors you need to concatenate in that
> > >>direction instead of horizontally...
>
> > >> x1=[1 2 3 4 5]'; x2=[10 20 30 40 50 60]';
> > >> X=[x1; x2];
> > >> whos x*
>
> > --- NO, I do not want that. If I do this, then the 2 predictor (x1 & x2) will be a reduced to single predictor!
> > My question was: If I have 3 predictor vectors x1, x2, x3 (each of them are of different lengths). How can I do multiple regression? If I want to use the function "regress" which requires
> > that X = [ones(size(x1)) x1 x2 x3]. But as my x1, x2 and x3 are of different length, I can not for X! What can I do now? Thanks.
>
> > dpb <n...@non.net> wrote in message <jvr55g$ep...@speranza.aioe.org>...
> > > On 8/7/2012 7:18 AM, Shariful wrote:
>
> > > ...[top posting repaired--don't do that: hard conversation follow makes]...
>
> > > > Torsten <Torsten.Hen...@umsicht.fraunhofer.de> wrote in message
> > > > <322a4998-56bb-43f7-9805-2bf00e34d...@j11g2000vbc.googlegroups.com>...
> > > >> On 7 Aug., 12:42, "Shariful " <endrom...@gmail.com> wrote:
> > > ...
> > > >> > I would like to use Matlab multiple regression function "regress (y,
> > > >> > X)". But I have a little problem. I have 3 predictor vectors x1,
> > > >> > x2, x3 of different length. >> How can I use them to build
> > > >> > X?
> > > ...
> > > >> Row j of the matrix X consist of the three predictor values [x1_i1
> > > >> x2_i2 x3_i3] (taken from your three
> > > >> predictor vectors x1, x2 and x3, respectively) that are associated
> > > >> with observation j in the y-vector.
> > > ...
>
> > > ...
> > > > My question is what should I do if x1, x2 and x3 are of different
> > > > length? For example,
> > > > suppose I have
>
> > > > x1=[1 2 3 4 5];
> > > > x2=[10 20 30 40 50 60];
> > > > If I try
> > > >>> X=[x1 x2]
> > > > I get an error which is expected: ??? Error using ==> horzcat
> > > > CAT arguments dimensions are not consistent.
>
> > > ????
>
> > > >> x1=[1 2 3 4 5]; x2=[10 20 30 40 50 60];
> > > >> X=[x1 x2];
>
> > > You mean you have
>
> > > x1=[1 2 3 4 5]'; x2=[10 20 30 40 50 60]';
>
> > > instead, I presume?
>
> > > If indeed you have column vectors you need to concatenate in that
> > > direction instead of horizontally...
>
> > > >> x1=[1 2 3 4 5]'; x2=[10 20 30 40 50 60]';
> > > >> X=[x1; x2];
> > > >> whos x*
> > > Name Size Bytes Class
>
> > > x1 5x1 40 double array
> > > x2 6x1 48 double array
> > > X 11x1 88 double array
>
> > > Read "Getting Started" section on arrays and matrices...
>
> > > --- Zitierten Text ausblenden -
>
> > - Zitierten Text anzeigen -
>
> Steven and me already answered your question.
>
> The matrix X must be given as follows:
> [x1(1) x2(1);
> x1(1) x2(2);
> ...
> x1(1) x2(M);
> x1(2) x2(1);
> x1(2) x2(2);
> ...
> x1(2) x2(M);
> ...
> x1(M) x2(1);
> x1(M) x2(2);
> ...
> x1(M) x2(N)]
>

Sorry, should read (for two predictors)
[x1(1) x2(1);
x1(1) x2(2);
...
x1(1) x2(N);
x1(2) x2(1);
x1(2) x2(2);
...
x1(2) x2(N);
...
x1(M) x2(1);
x1(M) x2(2);
...
x1(M) x2(N)]
if
x1=[x1(1) x1(2) ... x1(M)] and x2=[x2(1) x2(2) ... x2(N)].


> This is either accomplished by my 3-fold loop or the MESHGRID-
> facility.
>
> If you want to add a constant term in your regression model, the loop
> must be
> For i=1:I,
> For j=1:J,
> For k=1:K,
> X((i-1)*J*K+(j-1)*K+k,1:4)=[ 1 x1(i) x2(j) x3(k)];
> end
> end
> end
>
> Best wishes
> Torsten.- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -

Subject: Multiple regression

From: Shariful

Date: 7 Aug, 2012 14:44:15

Message: 10 of 14

Hi,
Thanks for your reply. We have a response variable y which is strongly correlated to three
other varibale, say, x1 (of length 20), x2 (of length 30) and x3 (of length 40). Now I would like
to obtain the multiple regression line by using x1, x2 and x3 as my predictor variables.

"Steven_Lord" <slord@mathworks.com> wrote in message <jvr502$mm$1@newscl01ah.mathworks.com>...
>
>
> "Shariful " <endromida@gmail.com> wrote in message
> news:jvr121$e8b$1@newscl01ah.mathworks.com...
> > Thanks for your reply. I know that X should be defined as X=[x1 x2 x3].
> > My question is what should I do if x1, x2 and x3 are of different length?
> > For example,
> > suppose I have
> >
> > x1=[1 2 3 4 5];
> > x2=[10 20 30 40 50 60];
>
> Do you have 5*6 = 30 data points, one for each combination of values where
> one comes from x1 and one from x2? If so, look at MESHGRID.
>
> If that's not your situation, you will need to say more about how you intend
> to do a regression for a function y = f(X) where the function sometimes
> accepts one input and sometimes two.
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

Subject: Multiple regression

From: Shariful

Date: 7 Aug, 2012 14:46:17

Message: 11 of 14

Hi Torsten,
I wonder why should I bulid my X in the following way?
---
For i=1:I,
  For j=1:J,
    For k=1:K,
       X((i-1)*J*K+(j-1)*K+k,1:3)=[x1(i) x2(j) x3(k)];
    end
  end
end
---
Could you please explain or refer me to the relevant literature? Thanks

Torsten <Torsten.Hennig@umsicht.fraunhofer.de> wrote in message <25d48a59-edc2-4c67-adf4-dda5eb3e8f1d@q3g2000vbc.googlegroups.com>...
> On 7 Aug., 14:18, "Shariful " <endrom...@gmail.com> wrote:
> > Thanks for your reply. I know that X should be defined as X=[x1 x2 x3]. My question is what should I do if x1, x2 and x3 are of different length? For example,
> > suppose I have
> >
> > x1=[1 2 3 4 5];
> > x2=[10 20 30 40 50 60];
> > If I try>> X=[x1 x2]
> >
> > I get an error which is expected: ??? Error using ==> horzcat
> > CAT arguments dimensions are not consistent.
> >
> >
> >
> > Torsten <Torsten.Hen...@umsicht.fraunhofer.de> wrote in message <322a4998-56bb-43f7-9805-2bf00e34d...@j11g2000vbc.googlegroups.com>...
> > > On 7 Aug., 12:42, "Shariful " <endrom...@gmail.com> wrote:
> > > > Dear Matlab Community,
> > > > I would like to use Matlab multiple regression function "regress (y, X)". But I have a little
> > > > problem. I have 3 predictor vectors x1, x2, x3 of different length. How can I use them to build
> > > > X?
> >
> > > > Thanks in advance for your help!
> > > > Shariful
> >
> > > Row j of the matrix X consist of the three predictor values [x1_i1
> > > x2_i2 x3_i3] (taken from your three
> > > predictor vectors x1, x2 and x3, respectively) that are associated
> > > with observation j in the y-vector.
> >
> > > Best wishes
> > > Torsten.- Zitierten Text ausblenden -
> >
> > - Zitierten Text anzeigen -
>
> For i=1:I,
> For j=1:J,
> For k=1:K,
> X((i-1)*J*K+(j-1)*K+k,1:3)=[x1(i) x2(j) x3(k)];
> end
> end
> end
>
> Best wishes
> Torsten.

Subject: Multiple regression

From: dpb

Date: 7 Aug, 2012 16:54:47

Message: 12 of 14

On 8/7/2012 8:47 AM, Shariful wrote:

DO _NOT_ TOP POST!!! Thank you...

> Thanks for your reply. Yes, I mean
> x1=[1 2 3 4 5]'; x2=[10 20 30 40 50 60]';
>
>>> If indeed you have column vectors you need to concatenate in that
>>> direction instead of horizontally...
>
> >> x1=[1 2 3 4 5]'; x2=[10 20 30 40 50 60]';
> >> X=[x1; x2];
> >> whos x*
>
> --- NO, I do not want that. If I do this, then the 2 predictor (x1 & x2)
> will be a reduced to single predictor!
> My question was: If I have 3 predictor vectors x1, x2, x3 (each of them
> are of different lengths). How can I do multiple regression? If I want
> to use the function "regress" which requires
> that X = [ones(size(x1)) x1 x2 x3]. But as my x1, x2 and x3 are of
> different length, I can not for X! What can I do now? Thanks.

...

Well that's not the question you demonstrated as being a problem...

The regression depends on what you have for responses -- if you have the
right number of responses then the meshgrid() response works.

--

Subject: Multiple regression

From: R

Date: 7 Aug, 2012 18:08:14

Message: 13 of 14

"Shariful" wrote in message <jvqre5$o7r$1@newscl01ah.mathworks.com>...
> Dear Matlab Community,
> I would like to use Matlab multiple regression function "regress (y, X)". But I have a little
> problem. I have 3 predictor vectors x1, x2, x3 of different length. How can I use them to build
> X?
>
> Thanks in advance for your help!
> Shariful

Shariful,

If I understand your message, you first need to know *why* x1, x2, etc. are different lengths. This depends on your source data. Presumably you understand that you can only run a regression on that subset of observations in which both the dependent variable and every explanatory variable is non-missing. One way or another, you need to restrict your y-values and all of your x-values to the same subset. At that point, all of your variables will be the same length.

Alternatively, you can let the regress function deal with missing values, but your variables still have to be the same length first. Create X = [x1 x2 ...], where x1 x2 etc. are all the same length because they have been padded to include NaNs for missing values. Obviously, though, you can't just add NaNs at the end of each vector that is too short --- maybe the 3rd element of x1 is missing, but the 5th element of x2 is missing. The NaNs should be in the appropriate places. Again, the correct way to do this depends on your source data.

Of course, restricting a regression to the non-missing subset of data may potentially bias your results depending on why the data are missing. This is an econometric and not a programming problem that you have to deal with.

Subject: Multiple regression

From: Bruno Luong

Date: 7 Aug, 2012 18:14:14

Message: 14 of 14

"Shariful" wrote in message <jvr9jv$k4l$1@newscl01ah.mathworks.com>...
> Hi,
> Thanks for your reply. We have a response variable y which is strongly correlated to three
> other varibale, say, x1 (of length 20), x2 (of length 30) and x3 (of length 40). Now I would like
> to obtain the multiple regression line by using x1, x2 and x3 as my predictor variables.

How many elements of y do you have? You must somehow a relationship between x1, x2, x3 and y, so they must always group by quadruplets, i.e., they must have the same length. If missing values occur, then you must fill by NaN where it occurs. But after filling vectors MUST have the same length.

Bruno

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
multiple regressio... Shariful 7 Aug, 2012 06:44:14
rssFeed for this Thread

Contact us