Can I use Linear Regression to model a nonlinear function? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Moderator Election Q&A - Questionnaire 2019 Community Moderator Election ResultsMultivariate linear regression in PythonWhen to use Linear Discriminant Analysis or Logistic Regressionlinear regression with “partitioned” dataHow to decide power of independent variables in case of non-linear polynomial regression?Best way to normalize datasets for a linear regression model?non-binary nominal variable in linear regressionLinear Model for Linear RegressionFinding the equation for a multiple and nonlinear regression model?Linear regression space transformationDoubts on using linear regression for change attribution

Are my PIs rude or am I just being too sensitive?

Is 1 ppb equal to 1 μg/kg?

What LEGO pieces have "real-world" functionality?

Dominant seventh chord in the major scale contains diminished triad of the seventh?

Using et al. for a last / senior author rather than for a first author

What does '1 unit of lemon juice' mean in a grandma's drink recipe?

Determinant is linear as a function of each of the rows of the matrix.

Is there a "higher Segal conjecture"?

What is the longest distance a 13th-level monk can jump while attacking on the same turn?

Gastric acid as a weapon

If 'B is more likely given A', then 'A is more likely given B'

Super Attribute Position on Product Page Magento 1

How do I mention the quality of my school without bragging

ListPlot join points by nearest neighbor rather than order

What happens to sewage if there is no river near by?

What do you call a phrase that's not an idiom yet?

What do you call a plan that's an alternative plan in case your initial plan fails?

Storing hydrofluoric acid before the invention of plastics

What is the musical term for a note that continously plays through a melody?

How to motivate offshore teams and trust them to deliver?

Proof involving the spectral radius and the Jordan canonical form

Diagram with tikz

How does a Death Domain cleric's Touch of Death feature work with Touch-range spells delivered by familiars?

Sorting numerically



Can I use Linear Regression to model a nonlinear function?



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Moderator Election Q&A - Questionnaire
2019 Community Moderator Election ResultsMultivariate linear regression in PythonWhen to use Linear Discriminant Analysis or Logistic Regressionlinear regression with “partitioned” dataHow to decide power of independent variables in case of non-linear polynomial regression?Best way to normalize datasets for a linear regression model?non-binary nominal variable in linear regressionLinear Model for Linear RegressionFinding the equation for a multiple and nonlinear regression model?Linear regression space transformationDoubts on using linear regression for change attribution










2












$begingroup$


I have recently started studying the basics about regression, and as a beginner I started by Linear Regression.



I read this article that says that for this particular type of regression the relationship between independent and dependent variables has to be linear, which to me implies that I can only predict "lines" with Linear regression:
https://www.analyticsvidhya.com/blog/2015/08/comprehensive-guide-regression/



But then I started wondering about how to model functions like "y = log(x)" or "y= sqrt(x)" or "y=exp(x)" or "y=tan(x)" or other nonlinear functions by definition which are not "lines" but "curves".



Then I carried on doing research until I found this article that says that it is not the relationship between the independent and dependent variables that should be linear, but the final functional form passed to the model:
https://medium.freecodecamp.org/learn-how-to-improve-your-linear-models-8294bfa8a731



I want to know if that is really the case, and is it always possible to do this "change" in the functional form? Also if it is possible to use linear regression for nonlinear functions, is it still correct to measure the performance of the model using R_square metric?



Thank you.










share|improve this question









$endgroup$




bumped to the homepage by Community 40 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.



















    2












    $begingroup$


    I have recently started studying the basics about regression, and as a beginner I started by Linear Regression.



    I read this article that says that for this particular type of regression the relationship between independent and dependent variables has to be linear, which to me implies that I can only predict "lines" with Linear regression:
    https://www.analyticsvidhya.com/blog/2015/08/comprehensive-guide-regression/



    But then I started wondering about how to model functions like "y = log(x)" or "y= sqrt(x)" or "y=exp(x)" or "y=tan(x)" or other nonlinear functions by definition which are not "lines" but "curves".



    Then I carried on doing research until I found this article that says that it is not the relationship between the independent and dependent variables that should be linear, but the final functional form passed to the model:
    https://medium.freecodecamp.org/learn-how-to-improve-your-linear-models-8294bfa8a731



    I want to know if that is really the case, and is it always possible to do this "change" in the functional form? Also if it is possible to use linear regression for nonlinear functions, is it still correct to measure the performance of the model using R_square metric?



    Thank you.










    share|improve this question









    $endgroup$




    bumped to the homepage by Community 40 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

















      2












      2








      2





      $begingroup$


      I have recently started studying the basics about regression, and as a beginner I started by Linear Regression.



      I read this article that says that for this particular type of regression the relationship between independent and dependent variables has to be linear, which to me implies that I can only predict "lines" with Linear regression:
      https://www.analyticsvidhya.com/blog/2015/08/comprehensive-guide-regression/



      But then I started wondering about how to model functions like "y = log(x)" or "y= sqrt(x)" or "y=exp(x)" or "y=tan(x)" or other nonlinear functions by definition which are not "lines" but "curves".



      Then I carried on doing research until I found this article that says that it is not the relationship between the independent and dependent variables that should be linear, but the final functional form passed to the model:
      https://medium.freecodecamp.org/learn-how-to-improve-your-linear-models-8294bfa8a731



      I want to know if that is really the case, and is it always possible to do this "change" in the functional form? Also if it is possible to use linear regression for nonlinear functions, is it still correct to measure the performance of the model using R_square metric?



      Thank you.










      share|improve this question









      $endgroup$




      I have recently started studying the basics about regression, and as a beginner I started by Linear Regression.



      I read this article that says that for this particular type of regression the relationship between independent and dependent variables has to be linear, which to me implies that I can only predict "lines" with Linear regression:
      https://www.analyticsvidhya.com/blog/2015/08/comprehensive-guide-regression/



      But then I started wondering about how to model functions like "y = log(x)" or "y= sqrt(x)" or "y=exp(x)" or "y=tan(x)" or other nonlinear functions by definition which are not "lines" but "curves".



      Then I carried on doing research until I found this article that says that it is not the relationship between the independent and dependent variables that should be linear, but the final functional form passed to the model:
      https://medium.freecodecamp.org/learn-how-to-improve-your-linear-models-8294bfa8a731



      I want to know if that is really the case, and is it always possible to do this "change" in the functional form? Also if it is possible to use linear regression for nonlinear functions, is it still correct to measure the performance of the model using R_square metric?



      Thank you.







      regression linear-regression






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 15 at 15:03









      Ahl AhlAhl Ahl

      111




      111





      bumped to the homepage by Community 40 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 40 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















          1 Answer
          1






          active

          oldest

          votes


















          0












          $begingroup$

          You are asking two different questions:



          1. What is linear regression?

          Linear regression means that, given a response variable $y$ and a set of predictors $x_i$, you are assuming (whether or not this is true is another matter) to model your response variable as
          $$
          y^(j)=sum_i=1^N x_i^(j)beta^i + epsilon^(j)
          $$

          for each observation $y^(j)$, where $epsilon^(j)$ is an error term with vanishing expectation value. The purpose of the algorithm is to find the set of $beta^i$ to minimise the errors between the above formula and the actual values of the response.



          1. May I use linear regressio to model non-linear functions?

          You may use the linear regression to model anything you want, this does not necessarily mean that the results will be a good fit. The mere decision to use a model makes no assumptions on whether the underlying equation is in fact reflected by the model you choose. In case of linear regression you are essentially approximating an $N$-dimensional manifold (where all true points belong) with their projections onto a plane. Whether or not this is a good idea it depends on the data.




          I want to know if that is really the case, and is it always possible to do this "change" in the functional form?




          By using this or that other model you are not changing the functional form of the underlying variables. You are just dictating that the original relation (that you do not know) can be approximated by the model you choose.




          Is it still correct to measure the performance of the model using R_square metric?




          The $R^2$ is defined as the ratio between the residual sum of squares of your model over the residual sum of squares of the average. Basically it tells how much of the variance of the data is explained by your model compared to just taking a straight line (in correspondence of the average) passing through all your data points.






          share|improve this answer









          $endgroup$












          • $begingroup$
            Thank you for you answer. It made a lot of dark points clearer in my mind!
            $endgroup$
            – Ahl Ahl
            Mar 15 at 16:05











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "557"
          ;
          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: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          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
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f47355%2fcan-i-use-linear-regression-to-model-a-nonlinear-function%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0












          $begingroup$

          You are asking two different questions:



          1. What is linear regression?

          Linear regression means that, given a response variable $y$ and a set of predictors $x_i$, you are assuming (whether or not this is true is another matter) to model your response variable as
          $$
          y^(j)=sum_i=1^N x_i^(j)beta^i + epsilon^(j)
          $$

          for each observation $y^(j)$, where $epsilon^(j)$ is an error term with vanishing expectation value. The purpose of the algorithm is to find the set of $beta^i$ to minimise the errors between the above formula and the actual values of the response.



          1. May I use linear regressio to model non-linear functions?

          You may use the linear regression to model anything you want, this does not necessarily mean that the results will be a good fit. The mere decision to use a model makes no assumptions on whether the underlying equation is in fact reflected by the model you choose. In case of linear regression you are essentially approximating an $N$-dimensional manifold (where all true points belong) with their projections onto a plane. Whether or not this is a good idea it depends on the data.




          I want to know if that is really the case, and is it always possible to do this "change" in the functional form?




          By using this or that other model you are not changing the functional form of the underlying variables. You are just dictating that the original relation (that you do not know) can be approximated by the model you choose.




          Is it still correct to measure the performance of the model using R_square metric?




          The $R^2$ is defined as the ratio between the residual sum of squares of your model over the residual sum of squares of the average. Basically it tells how much of the variance of the data is explained by your model compared to just taking a straight line (in correspondence of the average) passing through all your data points.






          share|improve this answer









          $endgroup$












          • $begingroup$
            Thank you for you answer. It made a lot of dark points clearer in my mind!
            $endgroup$
            – Ahl Ahl
            Mar 15 at 16:05















          0












          $begingroup$

          You are asking two different questions:



          1. What is linear regression?

          Linear regression means that, given a response variable $y$ and a set of predictors $x_i$, you are assuming (whether or not this is true is another matter) to model your response variable as
          $$
          y^(j)=sum_i=1^N x_i^(j)beta^i + epsilon^(j)
          $$

          for each observation $y^(j)$, where $epsilon^(j)$ is an error term with vanishing expectation value. The purpose of the algorithm is to find the set of $beta^i$ to minimise the errors between the above formula and the actual values of the response.



          1. May I use linear regressio to model non-linear functions?

          You may use the linear regression to model anything you want, this does not necessarily mean that the results will be a good fit. The mere decision to use a model makes no assumptions on whether the underlying equation is in fact reflected by the model you choose. In case of linear regression you are essentially approximating an $N$-dimensional manifold (where all true points belong) with their projections onto a plane. Whether or not this is a good idea it depends on the data.




          I want to know if that is really the case, and is it always possible to do this "change" in the functional form?




          By using this or that other model you are not changing the functional form of the underlying variables. You are just dictating that the original relation (that you do not know) can be approximated by the model you choose.




          Is it still correct to measure the performance of the model using R_square metric?




          The $R^2$ is defined as the ratio between the residual sum of squares of your model over the residual sum of squares of the average. Basically it tells how much of the variance of the data is explained by your model compared to just taking a straight line (in correspondence of the average) passing through all your data points.






          share|improve this answer









          $endgroup$












          • $begingroup$
            Thank you for you answer. It made a lot of dark points clearer in my mind!
            $endgroup$
            – Ahl Ahl
            Mar 15 at 16:05













          0












          0








          0





          $begingroup$

          You are asking two different questions:



          1. What is linear regression?

          Linear regression means that, given a response variable $y$ and a set of predictors $x_i$, you are assuming (whether or not this is true is another matter) to model your response variable as
          $$
          y^(j)=sum_i=1^N x_i^(j)beta^i + epsilon^(j)
          $$

          for each observation $y^(j)$, where $epsilon^(j)$ is an error term with vanishing expectation value. The purpose of the algorithm is to find the set of $beta^i$ to minimise the errors between the above formula and the actual values of the response.



          1. May I use linear regressio to model non-linear functions?

          You may use the linear regression to model anything you want, this does not necessarily mean that the results will be a good fit. The mere decision to use a model makes no assumptions on whether the underlying equation is in fact reflected by the model you choose. In case of linear regression you are essentially approximating an $N$-dimensional manifold (where all true points belong) with their projections onto a plane. Whether or not this is a good idea it depends on the data.




          I want to know if that is really the case, and is it always possible to do this "change" in the functional form?




          By using this or that other model you are not changing the functional form of the underlying variables. You are just dictating that the original relation (that you do not know) can be approximated by the model you choose.




          Is it still correct to measure the performance of the model using R_square metric?




          The $R^2$ is defined as the ratio between the residual sum of squares of your model over the residual sum of squares of the average. Basically it tells how much of the variance of the data is explained by your model compared to just taking a straight line (in correspondence of the average) passing through all your data points.






          share|improve this answer









          $endgroup$



          You are asking two different questions:



          1. What is linear regression?

          Linear regression means that, given a response variable $y$ and a set of predictors $x_i$, you are assuming (whether or not this is true is another matter) to model your response variable as
          $$
          y^(j)=sum_i=1^N x_i^(j)beta^i + epsilon^(j)
          $$

          for each observation $y^(j)$, where $epsilon^(j)$ is an error term with vanishing expectation value. The purpose of the algorithm is to find the set of $beta^i$ to minimise the errors between the above formula and the actual values of the response.



          1. May I use linear regressio to model non-linear functions?

          You may use the linear regression to model anything you want, this does not necessarily mean that the results will be a good fit. The mere decision to use a model makes no assumptions on whether the underlying equation is in fact reflected by the model you choose. In case of linear regression you are essentially approximating an $N$-dimensional manifold (where all true points belong) with their projections onto a plane. Whether or not this is a good idea it depends on the data.




          I want to know if that is really the case, and is it always possible to do this "change" in the functional form?




          By using this or that other model you are not changing the functional form of the underlying variables. You are just dictating that the original relation (that you do not know) can be approximated by the model you choose.




          Is it still correct to measure the performance of the model using R_square metric?




          The $R^2$ is defined as the ratio between the residual sum of squares of your model over the residual sum of squares of the average. Basically it tells how much of the variance of the data is explained by your model compared to just taking a straight line (in correspondence of the average) passing through all your data points.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 15 at 15:52









          gentedgented

          33218




          33218











          • $begingroup$
            Thank you for you answer. It made a lot of dark points clearer in my mind!
            $endgroup$
            – Ahl Ahl
            Mar 15 at 16:05
















          • $begingroup$
            Thank you for you answer. It made a lot of dark points clearer in my mind!
            $endgroup$
            – Ahl Ahl
            Mar 15 at 16:05















          $begingroup$
          Thank you for you answer. It made a lot of dark points clearer in my mind!
          $endgroup$
          – Ahl Ahl
          Mar 15 at 16:05




          $begingroup$
          Thank you for you answer. It made a lot of dark points clearer in my mind!
          $endgroup$
          – Ahl Ahl
          Mar 15 at 16:05

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Data Science 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%2fdatascience.stackexchange.com%2fquestions%2f47355%2fcan-i-use-linear-regression-to-model-a-nonlinear-function%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

          Францішак Багушэвіч Змест Сям'я | Біяграфія | Творчасць | Мова Багушэвіча | Ацэнкі дзейнасці | Цікавыя факты | Спадчына | Выбраная бібліяграфія | Ушанаванне памяці | У філатэліі | Зноскі | Літаратура | Спасылкі | НавігацыяЛяхоўскі У. Рупіўся дзеля Бога і людзей: Жыццёвы шлях Лявона Вітан-Дубейкаўскага // Вольскі і Памідораў з песняй пра немца Адвакат, паэт, народны заступнік Ашмянскі веснікВ Минске появится площадь Богушевича и улица Сырокомли, Белорусская деловая газета, 19 июля 2001 г.Айцец беларускай нацыянальнай ідэі паўстаў у бронзе Сяргей Аляксандравіч Адашкевіч (1918, Мінск). 80-я гады. Бюст «Францішак Багушэвіч».Яўген Мікалаевіч Ціхановіч. «Партрэт Францішка Багушэвіча»Мікола Мікалаевіч Купава. «Партрэт зачынальніка новай беларускай літаратуры Францішка Багушэвіча»Уладзімір Іванавіч Мелехаў. На помніку «Змагарам за родную мову» Барэльеф «Францішак Багушэвіч»Памяць пра Багушэвіча на Віленшчыне Страчаная сталіца. Беларускія шыльды на вуліцах Вільні«Krynica». Ideologia i przywódcy białoruskiego katolicyzmuФранцішак БагушэвічТворы на knihi.comТворы Францішка Багушэвіча на bellib.byСодаль Уладзімір. Францішак Багушэвіч на Лідчыне;Луцкевіч Антон. Жыцьцё і творчасьць Фр. Багушэвіча ў успамінах ягоных сучасьнікаў // Запісы Беларускага Навуковага таварыства. Вільня, 1938. Сшытак 1. С. 16-34.Большая российская1188761710000 0000 5537 633Xn9209310021619551927869394п

          Partai Komunis Tiongkok Daftar isi Kepemimpinan | Pranala luar | Referensi | Menu navigasidiperiksa1 perubahan tertundacpc.people.com.cnSitus resmiSurat kabar resmi"Why the Communist Party is alive, well and flourishing in China"0307-1235"Full text of Constitution of Communist Party of China"smengembangkannyas

          ValueError: Expected n_neighbors <= n_samples, but n_samples = 1, n_neighbors = 6 (SMOTE) The 2019 Stack Overflow Developer Survey Results Are InCan SMOTE be applied over sequence of words (sentences)?ValueError when doing validation with random forestsSMOTE and multi class oversamplingLogic behind SMOTE-NC?ValueError: Error when checking target: expected dense_1 to have shape (7,) but got array with shape (1,)SmoteBoost: Should SMOTE be ran individually for each iteration/tree in the boosting?solving multi-class imbalance classification using smote and OSSUsing SMOTE for Synthetic Data generation to improve performance on unbalanced dataproblem of entry format for a simple model in KerasSVM SMOTE fit_resample() function runs forever with no result