Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!c19g2000prf.googlegroups.com!not-for-mail
From: fas <faisalmufti@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: linear regression
Date: Sat, 17 May 2008 17:35:42 -0700 (PDT)
Organization: http://groups.google.com
Lines: 63
Message-ID: <2e7d4e65-1ce4-4bf3-8ab3-81f0bae4638c@c19g2000prf.googlegroups.com>
References: <13a0ad36-75d8-4ca0-b585-727d3a8ce1a9@w8g2000prd.googlegroups.com> 
NNTP-Posting-Host: 124.168.223.201
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Trace: posting.google.com 1211070942 22881 127.0.0.1 (18 May 2008 00:35:42 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sun, 18 May 2008 00:35:42 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: c19g2000prf.googlegroups.com; posting-host=124.168.223.201; 
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) 
Xref: news.mathworks.com comp.soft-sys.matlab:469049


On May 17, 9:51 pm, "John D'Errico" <woodch...@rochester.rr.com>
wrote:
> fas <faisalmu...@gmail.com> wrote in message <4c336df8-f903-4db2-
>
> bb4a-7a8cf785e...@j33g2000pri.googlegroups.com>...
>
>
>
> > On May 16, 11:31 pm, "John D'Errico" <woodch...@rochester.rr.com>
> > wrote:
> > > fas <faisalmu...@gmail.com> wrote in message <13a0ad36-75d8-
> 4ca0-b585-
>
> > > 727d3a8ce...@w8g2000prd.googlegroups.com>...
>
> > > > Hi
> > > > I want to do linear regression
> > > > X_vec=a*Y_vec + b
> > > > .
> > > > .
> > > > .
>
> > > > where X_vec(1....100) and Y_vec (1..100) are vectors (say of size
> > > > 100). So I have an overdetermined system where each vector value
> gives
> > > > me one equation and I want to determine 'a' and 'b' after regression.
> > > > I am bit novice any help?
>
> > > polyfit
>
> > > John
>
> > My data is 100x100, 2D which I have converted to X(:) as same for Y,
> > but it seems its not the right approach to run 1D polyfit on it. Any
> > idea what to do now
>
> You need to think about what you want to
> do, or at least explain yourself more clearly.
> You will find that learning to explain yourself
> clearly will often bring you directly to the
> answer that you need.
>
> You have an array X and an array Y. Originally
> you said that X and Y were vectors of length
> 100. Now you are telling us that they are
> arrays of size 100x100. It cannot be both.
>
> Try a little harder. Explain your problem.
>
> John

Ok, X and Y were for an example case are of size 100. In actual X and
Y are both of 2D of size (100x100  again example case). I converted
them to vectorized form as 10000x1. So I have 10000 equations each for
one point and now I want to fit polyfit. But the problem is that as
they are converted from 2D matrix. If I plot in 1D they do not appear
right and hence I believe polyfit may not work. The other option I can
think of is to sort it after converting it into vectorized form, so
that then can come in some order (for of some curve). Will it be ok to
apply polyfit on it. Will the coefficient that I find will have same
meaning or if the regression is done on the same 2D function (some
how)
Thanks,