<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169393</link>
    <title>MATLAB Central Newsreader - linear regression</title>
    <description>Feed for thread: linear regression</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2008 by The MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>The MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Fri, 16 May 2008 13:19:53 -0400</pubDate>
      <title>linear regression</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169393#432489</link>
      <author>fas</author>
      <description>Hi&lt;br&gt;
I want to do linear regression&lt;br&gt;
X_vec=a*Y_vec + b&lt;br&gt;
.&lt;br&gt;
.&lt;br&gt;
.&lt;br&gt;
&lt;br&gt;
where X_vec(1....100) and Y_vec (1..100) are vectors (say of size&lt;br&gt;
100). So I have an overdetermined system where each vector value gives&lt;br&gt;
me one equation and I want to determine 'a' and 'b' after regression.&lt;br&gt;
I am bit novice any help?&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Fri, 16 May 2008 13:28:29 -0400</pubDate>
      <title>Re: linear regression</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169393#432490</link>
      <author>Steven Lord</author>
      <description>&lt;br&gt;
"fas" &amp;lt;faisalmufti@gmail.com&amp;gt; wrote in message &lt;br&gt;
news:13a0ad36-75d8-4ca0-b585-727d3a8ce1a9@w8g2000prd.googlegroups.com...&lt;br&gt;
&amp;gt; Hi&lt;br&gt;
&amp;gt; I want to do linear regression&lt;br&gt;
&amp;gt; X_vec=a*Y_vec + b&lt;br&gt;
&amp;gt; .&lt;br&gt;
&amp;gt; .&lt;br&gt;
&amp;gt; .&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; where X_vec(1....100) and Y_vec (1..100) are vectors (say of size&lt;br&gt;
&amp;gt; 100). So I have an overdetermined system where each vector value gives&lt;br&gt;
&amp;gt; me one equation and I want to determine 'a' and 'b' after regression.&lt;br&gt;
&amp;gt; I am bit novice any help?&lt;br&gt;
&lt;br&gt;
Look at the Interactive Fitting and Programmatic Fitting sections of the &lt;br&gt;
Data Analysis documentation:&lt;br&gt;
&lt;br&gt;
&lt;a href="http://www.mathworks.com/access/helpdesk/help/techdoc/data_analysis/f1-6010.html"&gt;http://www.mathworks.com/access/helpdesk/help/techdoc/data_analysis/f1-6010.html&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
The first example on the Programmatic Fitting page does basically what you &lt;br&gt;
want.&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Steve Lord&lt;br&gt;
slord@mathworks.com &lt;br&gt;
&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Fri, 16 May 2008 13:31:01 -0400</pubDate>
      <title>Re: linear regression</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169393#432492</link>
      <author>John D'Errico</author>
      <description>fas &amp;lt;faisalmufti@gmail.com&amp;gt; wrote in message &amp;lt;13a0ad36-75d8-4ca0-b585-&lt;br&gt;
727d3a8ce1a9@w8g2000prd.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi&lt;br&gt;
&amp;gt; I want to do linear regression&lt;br&gt;
&amp;gt; X_vec=a*Y_vec + b&lt;br&gt;
&amp;gt; .&lt;br&gt;
&amp;gt; .&lt;br&gt;
&amp;gt; .&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; where X_vec(1....100) and Y_vec (1..100) are vectors (say of size&lt;br&gt;
&amp;gt; 100). So I have an overdetermined system where each vector value gives&lt;br&gt;
&amp;gt; me one equation and I want to determine 'a' and 'b' after regression.&lt;br&gt;
&amp;gt; I am bit novice any help?&lt;br&gt;
&lt;br&gt;
polyfit&lt;br&gt;
&lt;br&gt;
John&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Sat, 17 May 2008 11:12:46 -0400</pubDate>
      <title>Re: linear regression</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169393#432638</link>
      <author>fas</author>
      <description>On May 16, 11:31 pm, "John D'Errico" &amp;lt;woodch...@rochester.rr.com&amp;gt;&lt;br&gt;
wrote:&lt;br&gt;
&amp;gt; fas &amp;lt;faisalmu...@gmail.com&amp;gt; wrote in message &amp;lt;13a0ad36-75d8-4ca0-b585-&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; 727d3a8ce...@w8g2000prd.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Hi&lt;br&gt;
&amp;gt; &amp;gt; I want to do linear regression&lt;br&gt;
&amp;gt; &amp;gt; X_vec=a*Y_vec + b&lt;br&gt;
&amp;gt; &amp;gt; .&lt;br&gt;
&amp;gt; &amp;gt; .&lt;br&gt;
&amp;gt; &amp;gt; .&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; where X_vec(1....100) and Y_vec (1..100) are vectors (say of size&lt;br&gt;
&amp;gt; &amp;gt; 100). So I have an overdetermined system where each vector value gives&lt;br&gt;
&amp;gt; &amp;gt; me one equation and I want to determine 'a' and 'b' after regression.&lt;br&gt;
&amp;gt; &amp;gt; I am bit novice any help?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; polyfit&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; John&lt;br&gt;
&lt;br&gt;
My data is 100x100, 2D which I have converted to X(:) as same for Y,&lt;br&gt;
but it seems its not the right approach to run 1D polyfit on it. Any&lt;br&gt;
idea what to do now&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Sat, 17 May 2008 11:51:02 -0400</pubDate>
      <title>Re: linear regression</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169393#432643</link>
      <author>John D'Errico</author>
      <description>fas &amp;lt;faisalmufti@gmail.com&amp;gt; wrote in message &amp;lt;4c336df8-f903-4db2-&lt;br&gt;
bb4a-7a8cf785ec45@j33g2000pri.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; On May 16, 11:31 pm, "John D'Errico" &amp;lt;woodch...@rochester.rr.com&amp;gt;&lt;br&gt;
&amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt; fas &amp;lt;faisalmu...@gmail.com&amp;gt; wrote in message &amp;lt;13a0ad36-75d8-&lt;br&gt;
4ca0-b585-&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; 727d3a8ce...@w8g2000prd.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Hi&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; I want to do linear regression&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; X_vec=a*Y_vec + b&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; .&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; .&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; .&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; where X_vec(1....100) and Y_vec (1..100) are vectors (say of size&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; 100). So I have an overdetermined system where each vector value &lt;br&gt;
gives&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; me one equation and I want to determine 'a' and 'b' after regression.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; I am bit novice any help?&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; polyfit&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; John&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; My data is 100x100, 2D which I have converted to X(:) as same for Y,&lt;br&gt;
&amp;gt; but it seems its not the right approach to run 1D polyfit on it. Any&lt;br&gt;
&amp;gt; idea what to do now&lt;br&gt;
&lt;br&gt;
You need to think about what you want to&lt;br&gt;
do, or at least explain yourself more clearly.&lt;br&gt;
You will find that learning to explain yourself&lt;br&gt;
clearly will often bring you directly to the&lt;br&gt;
answer that you need.&lt;br&gt;
&lt;br&gt;
You have an array X and an array Y. Originally&lt;br&gt;
you said that X and Y were vectors of length&lt;br&gt;
100. Now you are telling us that they are&lt;br&gt;
arrays of size 100x100. It cannot be both.&lt;br&gt;
&lt;br&gt;
Try a little harder. Explain your problem.&lt;br&gt;
&lt;br&gt;
John&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Sun, 18 May 2008 00:35:42 -0400</pubDate>
      <title>Re: linear regression</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169393#432703</link>
      <author>fas</author>
      <description>On May 17, 9:51 pm, "John D'Errico" &amp;lt;woodch...@rochester.rr.com&amp;gt;&lt;br&gt;
wrote:&lt;br&gt;
&amp;gt; fas &amp;lt;faisalmu...@gmail.com&amp;gt; wrote in message &amp;lt;4c336df8-f903-4db2-&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; bb4a-7a8cf785e...@j33g2000pri.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; On May 16, 11:31 pm, "John D'Errico" &amp;lt;woodch...@rochester.rr.com&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; fas &amp;lt;faisalmu...@gmail.com&amp;gt; wrote in message &amp;lt;13a0ad36-75d8-&lt;br&gt;
&amp;gt; 4ca0-b585-&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; 727d3a8ce...@w8g2000prd.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; Hi&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; I want to do linear regression&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; X_vec=a*Y_vec + b&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; .&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; .&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; .&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; where X_vec(1....100) and Y_vec (1..100) are vectors (say of size&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; 100). So I have an overdetermined system where each vector value&lt;br&gt;
&amp;gt; gives&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; me one equation and I want to determine 'a' and 'b' after regression.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; I am bit novice any help?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; polyfit&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; John&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; My data is 100x100, 2D which I have converted to X(:) as same for Y,&lt;br&gt;
&amp;gt; &amp;gt; but it seems its not the right approach to run 1D polyfit on it. Any&lt;br&gt;
&amp;gt; &amp;gt; idea what to do now&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; You need to think about what you want to&lt;br&gt;
&amp;gt; do, or at least explain yourself more clearly.&lt;br&gt;
&amp;gt; You will find that learning to explain yourself&lt;br&gt;
&amp;gt; clearly will often bring you directly to the&lt;br&gt;
&amp;gt; answer that you need.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; You have an array X and an array Y. Originally&lt;br&gt;
&amp;gt; you said that X and Y were vectors of length&lt;br&gt;
&amp;gt; 100. Now you are telling us that they are&lt;br&gt;
&amp;gt; arrays of size 100x100. It cannot be both.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Try a little harder. Explain your problem.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; John&lt;br&gt;
&lt;br&gt;
Ok, X and Y were for an example case are of size 100. In actual X and&lt;br&gt;
Y are both of 2D of size (100x100  again example case). I converted&lt;br&gt;
them to vectorized form as 10000x1. So I have 10000 equations each for&lt;br&gt;
one point and now I want to fit polyfit. But the problem is that as&lt;br&gt;
they are converted from 2D matrix. If I plot in 1D they do not appear&lt;br&gt;
right and hence I believe polyfit may not work. The other option I can&lt;br&gt;
think of is to sort it after converting it into vectorized form, so&lt;br&gt;
that then can come in some order (for of some curve). Will it be ok to&lt;br&gt;
apply polyfit on it. Will the coefficient that I find will have same&lt;br&gt;
meaning or if the regression is done on the same 2D function (some&lt;br&gt;
how)&lt;br&gt;
Thanks,&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Sun, 18 May 2008 09:39:30 -0400</pubDate>
      <title>Re: linear regression</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169393#432733</link>
      <author>Greg Heath</author>
      <description>On May 17, 8:35=A0pm, fas &amp;lt;faisalmu...@gmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; On May 17, 9:51 pm, "John D'Errico" &amp;lt;woodch...@rochester.rr.com&amp;gt;&lt;br&gt;
&amp;gt; wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; fas &amp;lt;faisalmu...@gmail.com&amp;gt; wrote in message &amp;lt;4c336df8-f903-4db2-&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; bb4a-7a8cf785e...@j33g2000pri.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; On May 16, 11:31 pm, "John D'Errico" &amp;lt;woodch...@rochester.rr.com&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; fas &amp;lt;faisalmu...@gmail.com&amp;gt; wrote in message &amp;lt;13a0ad36-75d8-&lt;br&gt;
&amp;gt; &amp;gt; 4ca0-b585-&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; 727d3a8ce...@w8g2000prd.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; Hi&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; I want to do linear regression&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; X_vec=3Da*Y_vec + b&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; .&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; .&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; .&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; where X_vec(1....100) and Y_vec (1..100) are vectors (say of size&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; 100). So I have an overdetermined system where each vector value&lt;br&gt;
&amp;gt; &amp;gt; gives&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; me one equation and I want to determine 'a' and 'b' after regressi=&lt;br&gt;
on.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; I am bit novice any help?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; polyfit&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; John&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; My data is 100x100, 2D which I have converted to X(:) as same for Y,&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; but it seems its not the right approach to run 1D polyfit on it. Any&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; idea what to do now&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; You need to think about what you want to&lt;br&gt;
&amp;gt; &amp;gt; do, or at least explain yourself more clearly.&lt;br&gt;
&amp;gt; &amp;gt; You will find that learning to explain yourself&lt;br&gt;
&amp;gt; &amp;gt; clearly will often bring you directly to the&lt;br&gt;
&amp;gt; &amp;gt; answer that you need.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; You have an array X and an array Y. Originally&lt;br&gt;
&amp;gt; &amp;gt; you said that X and Y were vectors of length&lt;br&gt;
&amp;gt; &amp;gt; 100. Now you are telling us that they are&lt;br&gt;
&amp;gt; &amp;gt; arrays of size 100x100. It cannot be both.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Try a little harder. Explain your problem.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; John&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Ok, X and Y were for an example case are of size 100. In actual X and&lt;br&gt;
&amp;gt; Y are both of 2D of size (100x100 =A0again example case). I converted&lt;br&gt;
&amp;gt; them to vectorized form as 10000x1. So I have 10000 equations each for&lt;br&gt;
&amp;gt; one point and now I want to fit polyfit. But the problem is that as&lt;br&gt;
&amp;gt; they are converted from 2D matrix. If I plot in 1D they do not appear&lt;br&gt;
&amp;gt; right and hence I believe polyfit may not work. The other option I can&lt;br&gt;
&amp;gt; think of is to sort it after converting it into vectorized form, so&lt;br&gt;
&amp;gt; that then can come in some order (for of some curve). Will it be ok to&lt;br&gt;
&amp;gt; apply polyfit on it. Will the coefficient that I find will have same&lt;br&gt;
&amp;gt; meaning or if the regression is done on the same 2D function (some&lt;br&gt;
&amp;gt; how)&lt;br&gt;
&amp;gt; Thanks,-&lt;br&gt;
&lt;br&gt;
Why is it more difficult than solving&lt;br&gt;
&lt;br&gt;
Y =3D W*[ones(100);X]&lt;br&gt;
&lt;br&gt;
for W?&lt;br&gt;
&lt;br&gt;
Hope this helps.&lt;br&gt;
&lt;br&gt;
Greg&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Sun, 18 May 2008 10:18:46 -0400</pubDate>
      <title>Re: linear regression</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169393#432734</link>
      <author>fas</author>
      <description>On May 18, 7:39 pm, Greg Heath &amp;lt;he...@alumni.brown.edu&amp;gt; wrote:&lt;br&gt;
&amp;gt; On May 17, 8:35 pm, fas &amp;lt;faisalmu...@gmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; On May 17, 9:51 pm, "John D'Errico" &amp;lt;woodch...@rochester.rr.com&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; fas &amp;lt;faisalmu...@gmail.com&amp;gt; wrote in message &amp;lt;4c336df8-f903-4db2-&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; bb4a-7a8cf785e...@j33g2000pri.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; On May 16, 11:31 pm, "John D'Errico" &amp;lt;woodch...@rochester.rr.com&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; fas &amp;lt;faisalmu...@gmail.com&amp;gt; wrote in message &amp;lt;13a0ad36-75d8-&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; 4ca0-b585-&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; 727d3a8ce...@w8g2000prd.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; Hi&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; I want to do linear regression&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; X_vec=a*Y_vec + b&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; .&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; .&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; .&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; where X_vec(1....100) and Y_vec (1..100) are vectors (say of size&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; 100). So I have an overdetermined system where each vector value&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; gives&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; me one equation and I want to determine 'a' and 'b' after regression.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; I am bit novice any help?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; polyfit&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; John&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; My data is 100x100, 2D which I have converted to X(:) as same for Y,&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; but it seems its not the right approach to run 1D polyfit on it. Any&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; idea what to do now&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; You need to think about what you want to&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; do, or at least explain yourself more clearly.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; You will find that learning to explain yourself&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; clearly will often bring you directly to the&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; answer that you need.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; You have an array X and an array Y. Originally&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; you said that X and Y were vectors of length&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; 100. Now you are telling us that they are&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; arrays of size 100x100. It cannot be both.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Try a little harder. Explain your problem.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; John&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Ok, X and Y were for an example case are of size 100. In actual X and&lt;br&gt;
&amp;gt; &amp;gt; Y are both of 2D of size (100x100  again example case). I converted&lt;br&gt;
&amp;gt; &amp;gt; them to vectorized form as 10000x1. So I have 10000 equations each for&lt;br&gt;
&amp;gt; &amp;gt; one point and now I want to fit polyfit. But the problem is that as&lt;br&gt;
&amp;gt; &amp;gt; they are converted from 2D matrix. If I plot in 1D they do not appear&lt;br&gt;
&amp;gt; &amp;gt; right and hence I believe polyfit may not work. The other option I can&lt;br&gt;
&amp;gt; &amp;gt; think of is to sort it after converting it into vectorized form, so&lt;br&gt;
&amp;gt; &amp;gt; that then can come in some order (for of some curve). Will it be ok to&lt;br&gt;
&amp;gt; &amp;gt; apply polyfit on it. Will the coefficient that I find will have same&lt;br&gt;
&amp;gt; &amp;gt; meaning or if the regression is done on the same 2D function (some&lt;br&gt;
&amp;gt; &amp;gt; how)&lt;br&gt;
&amp;gt; &amp;gt; Thanks,-&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Why is it more difficult than solving&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Y = W*[ones(100);X]&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; for W?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Hope this helps.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Greg&lt;br&gt;
&lt;br&gt;
Sorry I could not get you completely. ?&lt;br&gt;
&lt;br&gt;
I would like to know that if we convert a nxm (matrix ) function to 1D&lt;br&gt;
and then sort it and then polyfit . Can we use the result. As in a 3D&lt;br&gt;
format( nxm) matrix I cannot use polyfit :(&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Sun, 18 May 2008 11:23:01 -0400</pubDate>
      <title>Re: linear regression</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169393#432737</link>
      <author>John D'Errico</author>
      <description>fas &amp;lt;faisalmufti@gmail.com&amp;gt; wrote in message &amp;lt;f4a869df-f422-47d9-&lt;br&gt;
bda7-1daafa173bb1@z16g2000prn.googlegroups.com&amp;gt;...&lt;br&gt;
&lt;br&gt;
&amp;gt; &amp;gt; Why is it more difficult than solving&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Y = W*[ones(100);X]&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; for W?&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Hope this helps.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Greg&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Sorry I could not get you completely. ?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I would like to know that if we convert a nxm (matrix ) function to 1D&lt;br&gt;
&amp;gt; and then sort it and then polyfit . Can we use the result. As in a 3D&lt;br&gt;
&amp;gt; format( nxm) matrix I cannot use polyfit :(&lt;br&gt;
&lt;br&gt;
Why do you state that it does not work?&lt;br&gt;
&lt;br&gt;
If your model is&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;X =a*Y + b&lt;br&gt;
&lt;br&gt;
then polyfit as applied to &lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;ab = polyfit(Y(:),X(:),1);&lt;br&gt;
&lt;br&gt;
will work. Equally as well, if you use backslash,&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;ab = [Y(:),ones(numel(Y),1)]\X(:);&lt;br&gt;
&lt;br&gt;
this will also work.&lt;br&gt;
&lt;br&gt;
John&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Sun, 18 May 2008 11:29:02 -0400</pubDate>
      <title>Re: linear regression</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169393#432739</link>
      <author>John D'Errico</author>
      <description>fas &amp;lt;faisalmufti@gmail.com&amp;gt; wrote in message &amp;lt;2e7d4e65-1ce4-4bf3-&lt;br&gt;
8ab3-81f0bae4638c@c19g2000prf.googlegroups.com&amp;gt;...&lt;br&gt;
&lt;br&gt;
&amp;gt; Ok, X and Y were for an example case are of size 100. In actual X and&lt;br&gt;
&amp;gt; Y are both of 2D of size (100x100  again example case). I converted&lt;br&gt;
&amp;gt; them to vectorized form as 10000x1. So I have 10000 equations each for&lt;br&gt;
&amp;gt; one point and now I want to fit polyfit. But the problem is that as&lt;br&gt;
&amp;gt; they are converted from 2D matrix. If I plot in 1D they do not appear&lt;br&gt;
&amp;gt; right and hence I believe polyfit may not work. The other option I can&lt;br&gt;
&amp;gt; think of is to sort it after converting it into vectorized form, so&lt;br&gt;
&amp;gt; that then can come in some order (for of some curve). Will it be ok to&lt;br&gt;
&amp;gt; apply polyfit on it. Will the coefficient that I find will have same&lt;br&gt;
&amp;gt; meaning or if the regression is done on the same 2D function (some&lt;br&gt;
&amp;gt; how)&lt;br&gt;
&amp;gt; Thanks,&lt;br&gt;
&lt;br&gt;
What does not "appear" right?&lt;br&gt;
&lt;br&gt;
If your model is as stated, then this is correct.&lt;br&gt;
&lt;br&gt;
I think that you are asking to do a 2-d regression,&lt;br&gt;
in both the x and y directinos, but for some reason&lt;br&gt;
do not realize that is what you want to do. Or, you&lt;br&gt;
just don't want to admit it.&lt;br&gt;
&lt;br&gt;
John&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Mon, 19 May 2008 04:51:40 -0400</pubDate>
      <title>Re: linear regression</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169393#432801</link>
      <author>fas</author>
      <description>On May 18, 9:29 pm, "John D'Errico" &amp;lt;woodch...@rochester.rr.com&amp;gt;&lt;br&gt;
wrote:&lt;br&gt;
&amp;gt; fas &amp;lt;faisalmu...@gmail.com&amp;gt; wrote in message &amp;lt;2e7d4e65-1ce4-4bf3-&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; 8ab3-81f0bae46...@c19g2000prf.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Ok, X and Y were for an example case are of size 100. In actual X and&lt;br&gt;
&amp;gt; &amp;gt; Y are both of 2D of size (100x100  again example case). I converted&lt;br&gt;
&amp;gt; &amp;gt; them to vectorized form as 10000x1. So I have 10000 equations each for&lt;br&gt;
&amp;gt; &amp;gt; one point and now I want to fit polyfit. But the problem is that as&lt;br&gt;
&amp;gt; &amp;gt; they are converted from 2D matrix. If I plot in 1D they do not appear&lt;br&gt;
&amp;gt; &amp;gt; right and hence I believe polyfit may not work. The other option I can&lt;br&gt;
&amp;gt; &amp;gt; think of is to sort it after converting it into vectorized form, so&lt;br&gt;
&amp;gt; &amp;gt; that then can come in some order (for of some curve). Will it be ok to&lt;br&gt;
&amp;gt; &amp;gt; apply polyfit on it. Will the coefficient that I find will have same&lt;br&gt;
&amp;gt; &amp;gt; meaning or if the regression is done on the same 2D function (some&lt;br&gt;
&amp;gt; &amp;gt; how)&lt;br&gt;
&amp;gt; &amp;gt; Thanks,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; What does not "appear" right?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; If your model is as stated, then this is correct.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I think that you are asking to do a 2-d regression,&lt;br&gt;
&amp;gt; in both the x and y directinos, but for some reason&lt;br&gt;
&amp;gt; do not realize that is what you want to do. Or, you&lt;br&gt;
&amp;gt; just don't want to admit it.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; John&lt;br&gt;
&lt;br&gt;
I admit that I wan to to do 2D regression. So if I want to to do that&lt;br&gt;
then doing a vectorization and sorting and then regression may not be&lt;br&gt;
right (Is it?). So in that case how to to 2D regression ?&lt;br&gt;
</description>
    </item>
  </channel>
</rss>
