(Possibly light question) Data linearization in curve fitting












0












$begingroup$


I was studying curve fitting in numerical methods and met an approximation curve of the form $y=frac{x}{A+Bx}$. We were supposed to linearize this curve before applying the least square method, but two linearizations:





  1. $Y=1/y$ and $X=1/x$, and


  2. $Y=x/y$ and $X=x$


gave two different results for $A$ and $B$ respectively. I kept making sure that I put the right values in the normal equations, but is it just possible that two different linearization methods give different constants? I forget about it, but I remember an equation that I linearized in two different ways produced the same constants. Or is it just me?



Note: No.1 is obtained by taking reciprocal of both sides. No.2 is obtained by switching y and the denominator on the right hand side.










share|cite|improve this question









$endgroup$

















    0












    $begingroup$


    I was studying curve fitting in numerical methods and met an approximation curve of the form $y=frac{x}{A+Bx}$. We were supposed to linearize this curve before applying the least square method, but two linearizations:





    1. $Y=1/y$ and $X=1/x$, and


    2. $Y=x/y$ and $X=x$


    gave two different results for $A$ and $B$ respectively. I kept making sure that I put the right values in the normal equations, but is it just possible that two different linearization methods give different constants? I forget about it, but I remember an equation that I linearized in two different ways produced the same constants. Or is it just me?



    Note: No.1 is obtained by taking reciprocal of both sides. No.2 is obtained by switching y and the denominator on the right hand side.










    share|cite|improve this question









    $endgroup$















      0












      0








      0





      $begingroup$


      I was studying curve fitting in numerical methods and met an approximation curve of the form $y=frac{x}{A+Bx}$. We were supposed to linearize this curve before applying the least square method, but two linearizations:





      1. $Y=1/y$ and $X=1/x$, and


      2. $Y=x/y$ and $X=x$


      gave two different results for $A$ and $B$ respectively. I kept making sure that I put the right values in the normal equations, but is it just possible that two different linearization methods give different constants? I forget about it, but I remember an equation that I linearized in two different ways produced the same constants. Or is it just me?



      Note: No.1 is obtained by taking reciprocal of both sides. No.2 is obtained by switching y and the denominator on the right hand side.










      share|cite|improve this question









      $endgroup$




      I was studying curve fitting in numerical methods and met an approximation curve of the form $y=frac{x}{A+Bx}$. We were supposed to linearize this curve before applying the least square method, but two linearizations:





      1. $Y=1/y$ and $X=1/x$, and


      2. $Y=x/y$ and $X=x$


      gave two different results for $A$ and $B$ respectively. I kept making sure that I put the right values in the normal equations, but is it just possible that two different linearization methods give different constants? I forget about it, but I remember an equation that I linearized in two different ways produced the same constants. Or is it just me?



      Note: No.1 is obtained by taking reciprocal of both sides. No.2 is obtained by switching y and the denominator on the right hand side.







      numerical-methods linearization






      share|cite|improve this question













      share|cite|improve this question











      share|cite|improve this question




      share|cite|improve this question










      asked Dec 15 '18 at 4:41









      bmsbms

      335




      335






















          2 Answers
          2






          active

          oldest

          votes


















          2












          $begingroup$

          What AlexanderJ93 answered is perfectly correct if there is no error in the data.



          If there are, just as you observed, two diffferent linearizations will provide different answers and this is normal since the considered sum of squares are diiferent
          $$SSQ_1=sum_{i=1}^n left(B+frac A {x_i}-frac 1{y_i} right)^2$$
          $$SSQ_2=sum_{i=1}^n left(A+B {x_i}-frac {x_i}{y_i} right)^2$$



          Let us take as an example the following data which contain very small errors
          $$left(
          begin{array}{cc}
          x & y \
          1 & 28 \
          2 & 34 \
          3 & 36 \
          4 & 38 \
          5 & 39 \
          6 & 39
          end{array}
          right)$$



          The first regression would give
          $$begin{array}{clclclclc}
          text{} & text{Estimate} & text{Standard Error} & text{Confidence Interval} \
          A & 0.012299 & 0.000374 & {0.011109,0.013490} \
          B & 0.023395 & 0.000186 & {0.022801,0.023988} \
          end{array}$$
          while the second would give
          $$begin{array}{clclclclc}
          text{} & text{Estimate} & text{Standard Error} & text{Confidence Interval} \
          A & 0.012124 & 0.001026 & {0.008858,0.015390} \
          B & 0.023450 & 0.000266 & {0.022611,0.024288} \
          end{array}$$



          The corefficients are similar but not identical.



          In any manner, after linearization, you need to go to nonlinear regression since what is measured is $y$ and not $frac 1 y$ or $frac x y$.



          Using any of the above estimates, using nonlinear regression, you would get
          $$begin{array}{clclclclc}
          text{} & text{Estimate} & text{Standard Error} & text{Confidence Interval} \
          A & 0.012281 & 0.000563 & {0.010490,0.014071} \
          B & 0.023400 & 0.000209 & {0.022736,0.024064} \
          end{array}$$






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            My bad I asked the question in the general case, since I think it should be fine. This answer confirms it then. In my special case, my $x$ data is 0.5, 1.0, 1.5, and 2.0; and the paired $y$ data is 1.00, 0.75, 1.00, and 2.00. As I mentioned, I try this using both linearization methods, and they give different values. Now I know surely they may not give the same constants.
            $endgroup$
            – bms
            Dec 15 '18 at 14:54






          • 1




            $begingroup$
            @bms. What you observed is totally normal as soon as the data do not lead to an absolutely perfect fit. It would be much worse with a model such as $y=e^{a+b x}$. Don't worry : you will learn about it. But, please, remember that linearization is just a preliminary step to get estimates of the parameters and that, next, you need to use nonlinear regression since (I insist) what is measured is $y$ and not any of its possible transforms. Cheers.
            $endgroup$
            – Claude Leibovici
            Dec 15 '18 at 15:08





















          0












          $begingroup$

          These two linearizations work for any $A,B$. The difference between them is that they swap the roles of $A$ and $B$. The first one evaluates to $Y = AX+B$, while the second evaluates to $Y=BX+A$. Whatever the values for $A$ and $B$ are, they are the same between the equations, but in the first one $A$ is the slope and $B$ is the intercept, while in the second one $B$ is the slope and $A$ is the intercept.






          share|cite|improve this answer









          $endgroup$













            Your Answer





            StackExchange.ifUsing("editor", function () {
            return StackExchange.using("mathjaxEditing", function () {
            StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
            StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
            });
            });
            }, "mathjax-editing");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "69"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            noCode: true, onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3040179%2fpossibly-light-question-data-linearization-in-curve-fitting%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2












            $begingroup$

            What AlexanderJ93 answered is perfectly correct if there is no error in the data.



            If there are, just as you observed, two diffferent linearizations will provide different answers and this is normal since the considered sum of squares are diiferent
            $$SSQ_1=sum_{i=1}^n left(B+frac A {x_i}-frac 1{y_i} right)^2$$
            $$SSQ_2=sum_{i=1}^n left(A+B {x_i}-frac {x_i}{y_i} right)^2$$



            Let us take as an example the following data which contain very small errors
            $$left(
            begin{array}{cc}
            x & y \
            1 & 28 \
            2 & 34 \
            3 & 36 \
            4 & 38 \
            5 & 39 \
            6 & 39
            end{array}
            right)$$



            The first regression would give
            $$begin{array}{clclclclc}
            text{} & text{Estimate} & text{Standard Error} & text{Confidence Interval} \
            A & 0.012299 & 0.000374 & {0.011109,0.013490} \
            B & 0.023395 & 0.000186 & {0.022801,0.023988} \
            end{array}$$
            while the second would give
            $$begin{array}{clclclclc}
            text{} & text{Estimate} & text{Standard Error} & text{Confidence Interval} \
            A & 0.012124 & 0.001026 & {0.008858,0.015390} \
            B & 0.023450 & 0.000266 & {0.022611,0.024288} \
            end{array}$$



            The corefficients are similar but not identical.



            In any manner, after linearization, you need to go to nonlinear regression since what is measured is $y$ and not $frac 1 y$ or $frac x y$.



            Using any of the above estimates, using nonlinear regression, you would get
            $$begin{array}{clclclclc}
            text{} & text{Estimate} & text{Standard Error} & text{Confidence Interval} \
            A & 0.012281 & 0.000563 & {0.010490,0.014071} \
            B & 0.023400 & 0.000209 & {0.022736,0.024064} \
            end{array}$$






            share|cite|improve this answer









            $endgroup$













            • $begingroup$
              My bad I asked the question in the general case, since I think it should be fine. This answer confirms it then. In my special case, my $x$ data is 0.5, 1.0, 1.5, and 2.0; and the paired $y$ data is 1.00, 0.75, 1.00, and 2.00. As I mentioned, I try this using both linearization methods, and they give different values. Now I know surely they may not give the same constants.
              $endgroup$
              – bms
              Dec 15 '18 at 14:54






            • 1




              $begingroup$
              @bms. What you observed is totally normal as soon as the data do not lead to an absolutely perfect fit. It would be much worse with a model such as $y=e^{a+b x}$. Don't worry : you will learn about it. But, please, remember that linearization is just a preliminary step to get estimates of the parameters and that, next, you need to use nonlinear regression since (I insist) what is measured is $y$ and not any of its possible transforms. Cheers.
              $endgroup$
              – Claude Leibovici
              Dec 15 '18 at 15:08


















            2












            $begingroup$

            What AlexanderJ93 answered is perfectly correct if there is no error in the data.



            If there are, just as you observed, two diffferent linearizations will provide different answers and this is normal since the considered sum of squares are diiferent
            $$SSQ_1=sum_{i=1}^n left(B+frac A {x_i}-frac 1{y_i} right)^2$$
            $$SSQ_2=sum_{i=1}^n left(A+B {x_i}-frac {x_i}{y_i} right)^2$$



            Let us take as an example the following data which contain very small errors
            $$left(
            begin{array}{cc}
            x & y \
            1 & 28 \
            2 & 34 \
            3 & 36 \
            4 & 38 \
            5 & 39 \
            6 & 39
            end{array}
            right)$$



            The first regression would give
            $$begin{array}{clclclclc}
            text{} & text{Estimate} & text{Standard Error} & text{Confidence Interval} \
            A & 0.012299 & 0.000374 & {0.011109,0.013490} \
            B & 0.023395 & 0.000186 & {0.022801,0.023988} \
            end{array}$$
            while the second would give
            $$begin{array}{clclclclc}
            text{} & text{Estimate} & text{Standard Error} & text{Confidence Interval} \
            A & 0.012124 & 0.001026 & {0.008858,0.015390} \
            B & 0.023450 & 0.000266 & {0.022611,0.024288} \
            end{array}$$



            The corefficients are similar but not identical.



            In any manner, after linearization, you need to go to nonlinear regression since what is measured is $y$ and not $frac 1 y$ or $frac x y$.



            Using any of the above estimates, using nonlinear regression, you would get
            $$begin{array}{clclclclc}
            text{} & text{Estimate} & text{Standard Error} & text{Confidence Interval} \
            A & 0.012281 & 0.000563 & {0.010490,0.014071} \
            B & 0.023400 & 0.000209 & {0.022736,0.024064} \
            end{array}$$






            share|cite|improve this answer









            $endgroup$













            • $begingroup$
              My bad I asked the question in the general case, since I think it should be fine. This answer confirms it then. In my special case, my $x$ data is 0.5, 1.0, 1.5, and 2.0; and the paired $y$ data is 1.00, 0.75, 1.00, and 2.00. As I mentioned, I try this using both linearization methods, and they give different values. Now I know surely they may not give the same constants.
              $endgroup$
              – bms
              Dec 15 '18 at 14:54






            • 1




              $begingroup$
              @bms. What you observed is totally normal as soon as the data do not lead to an absolutely perfect fit. It would be much worse with a model such as $y=e^{a+b x}$. Don't worry : you will learn about it. But, please, remember that linearization is just a preliminary step to get estimates of the parameters and that, next, you need to use nonlinear regression since (I insist) what is measured is $y$ and not any of its possible transforms. Cheers.
              $endgroup$
              – Claude Leibovici
              Dec 15 '18 at 15:08
















            2












            2








            2





            $begingroup$

            What AlexanderJ93 answered is perfectly correct if there is no error in the data.



            If there are, just as you observed, two diffferent linearizations will provide different answers and this is normal since the considered sum of squares are diiferent
            $$SSQ_1=sum_{i=1}^n left(B+frac A {x_i}-frac 1{y_i} right)^2$$
            $$SSQ_2=sum_{i=1}^n left(A+B {x_i}-frac {x_i}{y_i} right)^2$$



            Let us take as an example the following data which contain very small errors
            $$left(
            begin{array}{cc}
            x & y \
            1 & 28 \
            2 & 34 \
            3 & 36 \
            4 & 38 \
            5 & 39 \
            6 & 39
            end{array}
            right)$$



            The first regression would give
            $$begin{array}{clclclclc}
            text{} & text{Estimate} & text{Standard Error} & text{Confidence Interval} \
            A & 0.012299 & 0.000374 & {0.011109,0.013490} \
            B & 0.023395 & 0.000186 & {0.022801,0.023988} \
            end{array}$$
            while the second would give
            $$begin{array}{clclclclc}
            text{} & text{Estimate} & text{Standard Error} & text{Confidence Interval} \
            A & 0.012124 & 0.001026 & {0.008858,0.015390} \
            B & 0.023450 & 0.000266 & {0.022611,0.024288} \
            end{array}$$



            The corefficients are similar but not identical.



            In any manner, after linearization, you need to go to nonlinear regression since what is measured is $y$ and not $frac 1 y$ or $frac x y$.



            Using any of the above estimates, using nonlinear regression, you would get
            $$begin{array}{clclclclc}
            text{} & text{Estimate} & text{Standard Error} & text{Confidence Interval} \
            A & 0.012281 & 0.000563 & {0.010490,0.014071} \
            B & 0.023400 & 0.000209 & {0.022736,0.024064} \
            end{array}$$






            share|cite|improve this answer









            $endgroup$



            What AlexanderJ93 answered is perfectly correct if there is no error in the data.



            If there are, just as you observed, two diffferent linearizations will provide different answers and this is normal since the considered sum of squares are diiferent
            $$SSQ_1=sum_{i=1}^n left(B+frac A {x_i}-frac 1{y_i} right)^2$$
            $$SSQ_2=sum_{i=1}^n left(A+B {x_i}-frac {x_i}{y_i} right)^2$$



            Let us take as an example the following data which contain very small errors
            $$left(
            begin{array}{cc}
            x & y \
            1 & 28 \
            2 & 34 \
            3 & 36 \
            4 & 38 \
            5 & 39 \
            6 & 39
            end{array}
            right)$$



            The first regression would give
            $$begin{array}{clclclclc}
            text{} & text{Estimate} & text{Standard Error} & text{Confidence Interval} \
            A & 0.012299 & 0.000374 & {0.011109,0.013490} \
            B & 0.023395 & 0.000186 & {0.022801,0.023988} \
            end{array}$$
            while the second would give
            $$begin{array}{clclclclc}
            text{} & text{Estimate} & text{Standard Error} & text{Confidence Interval} \
            A & 0.012124 & 0.001026 & {0.008858,0.015390} \
            B & 0.023450 & 0.000266 & {0.022611,0.024288} \
            end{array}$$



            The corefficients are similar but not identical.



            In any manner, after linearization, you need to go to nonlinear regression since what is measured is $y$ and not $frac 1 y$ or $frac x y$.



            Using any of the above estimates, using nonlinear regression, you would get
            $$begin{array}{clclclclc}
            text{} & text{Estimate} & text{Standard Error} & text{Confidence Interval} \
            A & 0.012281 & 0.000563 & {0.010490,0.014071} \
            B & 0.023400 & 0.000209 & {0.022736,0.024064} \
            end{array}$$







            share|cite|improve this answer












            share|cite|improve this answer



            share|cite|improve this answer










            answered Dec 15 '18 at 6:23









            Claude LeiboviciClaude Leibovici

            122k1157134




            122k1157134












            • $begingroup$
              My bad I asked the question in the general case, since I think it should be fine. This answer confirms it then. In my special case, my $x$ data is 0.5, 1.0, 1.5, and 2.0; and the paired $y$ data is 1.00, 0.75, 1.00, and 2.00. As I mentioned, I try this using both linearization methods, and they give different values. Now I know surely they may not give the same constants.
              $endgroup$
              – bms
              Dec 15 '18 at 14:54






            • 1




              $begingroup$
              @bms. What you observed is totally normal as soon as the data do not lead to an absolutely perfect fit. It would be much worse with a model such as $y=e^{a+b x}$. Don't worry : you will learn about it. But, please, remember that linearization is just a preliminary step to get estimates of the parameters and that, next, you need to use nonlinear regression since (I insist) what is measured is $y$ and not any of its possible transforms. Cheers.
              $endgroup$
              – Claude Leibovici
              Dec 15 '18 at 15:08




















            • $begingroup$
              My bad I asked the question in the general case, since I think it should be fine. This answer confirms it then. In my special case, my $x$ data is 0.5, 1.0, 1.5, and 2.0; and the paired $y$ data is 1.00, 0.75, 1.00, and 2.00. As I mentioned, I try this using both linearization methods, and they give different values. Now I know surely they may not give the same constants.
              $endgroup$
              – bms
              Dec 15 '18 at 14:54






            • 1




              $begingroup$
              @bms. What you observed is totally normal as soon as the data do not lead to an absolutely perfect fit. It would be much worse with a model such as $y=e^{a+b x}$. Don't worry : you will learn about it. But, please, remember that linearization is just a preliminary step to get estimates of the parameters and that, next, you need to use nonlinear regression since (I insist) what is measured is $y$ and not any of its possible transforms. Cheers.
              $endgroup$
              – Claude Leibovici
              Dec 15 '18 at 15:08


















            $begingroup$
            My bad I asked the question in the general case, since I think it should be fine. This answer confirms it then. In my special case, my $x$ data is 0.5, 1.0, 1.5, and 2.0; and the paired $y$ data is 1.00, 0.75, 1.00, and 2.00. As I mentioned, I try this using both linearization methods, and they give different values. Now I know surely they may not give the same constants.
            $endgroup$
            – bms
            Dec 15 '18 at 14:54




            $begingroup$
            My bad I asked the question in the general case, since I think it should be fine. This answer confirms it then. In my special case, my $x$ data is 0.5, 1.0, 1.5, and 2.0; and the paired $y$ data is 1.00, 0.75, 1.00, and 2.00. As I mentioned, I try this using both linearization methods, and they give different values. Now I know surely they may not give the same constants.
            $endgroup$
            – bms
            Dec 15 '18 at 14:54




            1




            1




            $begingroup$
            @bms. What you observed is totally normal as soon as the data do not lead to an absolutely perfect fit. It would be much worse with a model such as $y=e^{a+b x}$. Don't worry : you will learn about it. But, please, remember that linearization is just a preliminary step to get estimates of the parameters and that, next, you need to use nonlinear regression since (I insist) what is measured is $y$ and not any of its possible transforms. Cheers.
            $endgroup$
            – Claude Leibovici
            Dec 15 '18 at 15:08






            $begingroup$
            @bms. What you observed is totally normal as soon as the data do not lead to an absolutely perfect fit. It would be much worse with a model such as $y=e^{a+b x}$. Don't worry : you will learn about it. But, please, remember that linearization is just a preliminary step to get estimates of the parameters and that, next, you need to use nonlinear regression since (I insist) what is measured is $y$ and not any of its possible transforms. Cheers.
            $endgroup$
            – Claude Leibovici
            Dec 15 '18 at 15:08













            0












            $begingroup$

            These two linearizations work for any $A,B$. The difference between them is that they swap the roles of $A$ and $B$. The first one evaluates to $Y = AX+B$, while the second evaluates to $Y=BX+A$. Whatever the values for $A$ and $B$ are, they are the same between the equations, but in the first one $A$ is the slope and $B$ is the intercept, while in the second one $B$ is the slope and $A$ is the intercept.






            share|cite|improve this answer









            $endgroup$


















              0












              $begingroup$

              These two linearizations work for any $A,B$. The difference between them is that they swap the roles of $A$ and $B$. The first one evaluates to $Y = AX+B$, while the second evaluates to $Y=BX+A$. Whatever the values for $A$ and $B$ are, they are the same between the equations, but in the first one $A$ is the slope and $B$ is the intercept, while in the second one $B$ is the slope and $A$ is the intercept.






              share|cite|improve this answer









              $endgroup$
















                0












                0








                0





                $begingroup$

                These two linearizations work for any $A,B$. The difference between them is that they swap the roles of $A$ and $B$. The first one evaluates to $Y = AX+B$, while the second evaluates to $Y=BX+A$. Whatever the values for $A$ and $B$ are, they are the same between the equations, but in the first one $A$ is the slope and $B$ is the intercept, while in the second one $B$ is the slope and $A$ is the intercept.






                share|cite|improve this answer









                $endgroup$



                These two linearizations work for any $A,B$. The difference between them is that they swap the roles of $A$ and $B$. The first one evaluates to $Y = AX+B$, while the second evaluates to $Y=BX+A$. Whatever the values for $A$ and $B$ are, they are the same between the equations, but in the first one $A$ is the slope and $B$ is the intercept, while in the second one $B$ is the slope and $A$ is the intercept.







                share|cite|improve this answer












                share|cite|improve this answer



                share|cite|improve this answer










                answered Dec 15 '18 at 4:55









                AlexanderJ93AlexanderJ93

                6,173823




                6,173823






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Mathematics Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    Use MathJax to format equations. MathJax reference.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3040179%2fpossibly-light-question-data-linearization-in-curve-fitting%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    How do I know what Microsoft account the skydrive app is syncing to?

                    When does type information flow backwards in C++?

                    Grease: Live!