Prev: Help! Multiple regression specifying different functional forms
Next: chaning a part of cell arrays
From: Jay-Anne Padayao on 5 Mar 2010 16:48 Hi!.. I am having a hard time doing a program regarding Multiple regression,wherein the user is prompt to input the independent variable(x1,x2,x3,...xn)as well as the dependent variable y. I can only do it with 2 independent variable,but I can't function it anymore if I try having three and more independent variables. Need your help!.. Thanks! Regards, Jen
From: TideMan on 5 Mar 2010 17:27 On Mar 6, 10:48 am, Jay-Anne Padayao <jayanne.pada...(a)gmail.com> wrote: > Hi!.. > I am having a hard time doing a program regarding Multiple > regression,wherein the user is prompt to input the independent > variable(x1,x2,x3,...xn)as well as the dependent variable y. > > I can only do it with 2 independent variable,but I can't function it > anymore if I try having three and more independent variables. > > Need your help!.. > Thanks! > > Regards, > Jen The general solution is: A\y where A is a matrix of the independent variables. I don't understand why you have problems with more than two independent variables. Matlab does all the work for you.
From: Jay-Anne Padayao on 5 Mar 2010 17:41 > The general solution is: > A\y > where A is a matrix of the independent variables. > I don't understand why you have problems with more than two > independent variables. Matlab does all the work for you. Yes..but my problem goes with the fact that this program must be applicable to any user input.. What i mean is..the user must be asked the ff: How many independent variables do you have: (the no. of x values to be asked below depends to the answer to this question) Input x1: Input x2: Input xn: Input Y: coeff= The equation will be:
From: TideMan on 5 Mar 2010 17:51 On Mar 6, 11:41 am, Jay-Anne Padayao <jayanne.pada...(a)gmail.com> wrote: > > The general solution is: > > A\y > > where A is a matrix of the independent variables. > > I don't understand why you have problems with more than two > > independent variables. Matlab does all the work for you. > > Yes..but my problem goes with the fact that this program must be > applicable to any user input.. > What i mean is..the user must be asked the ff: > How many independent variables do you have: > (the no. of x values to be asked below depends to the answer to this > question) > Input x1: > Input x2: > Input xn: > Input Y: > coeff= > The equation will be: Well don't put them in individual vectors. That takes too much programming. Put them straight into the matrix A. A=zeros(nt,nvar); % preallocate then first x goes into A(:,1), second into A(:,2), and so on.
From: Jay-Anne Padayao on 5 Mar 2010 18:07 > Well don't put them in individual vectors. > That takes too much programming. > Put them straight into the matrix A. > A=zeros(nt,nvar); % preallocate > then first x goes into A(:,1), second into A(:,2), and so on. ok..I'll do it..I am not familiar with (nt,nvar); what does this mean?... and..after getting A, will it still go to the same process? b= A\y?
|
Pages: 1 Prev: Help! Multiple regression specifying different functional forms Next: chaning a part of cell arrays |