Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!b64g2000hsa.googlegroups.com!not-for-mail
From: Greg Heath <heath@alumni.brown.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: linear regression
Date: Sun, 18 May 2008 02:39:30 -0700 (PDT)
Organization: http://groups.google.com
Lines: 78
Message-ID: <01ba4d02-882a-4bc7-a0b7-d4dff90acd06@b64g2000hsa.googlegroups.com>
References: <13a0ad36-75d8-4ca0-b585-727d3a8ce1a9@w8g2000prd.googlegroups.com> 
NNTP-Posting-Host: 69.141.173.117
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1211103571 3259 127.0.0.1 (18 May 2008 09:39:31 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sun, 18 May 2008 09:39:31 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: b64g2000hsa.googlegroups.com; posting-host=69.141.173.117; 
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; 
Xref: news.mathworks.com comp.soft-sys.matlab:469079


On May 17, 8:35=A0pm, fas <faisalmu...@gmail.com> wrote:
> 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=3Da*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 regressi=
on.
> > > > > 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 =A0again 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,-

Why is it more difficult than solving

Y =3D W*[ones(100);X]

for W?

Hope this helps.

Greg