Can I use Linear Regression to model a nonlinear function?Multivariate 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
What does Jesus mean regarding "Raca," and "you fool?" - is he contrasting them?
World War I as a war of liberals against authoritarians?
Knife as defense against stray dogs
What does Deadpool mean by "left the house in that shirt"?
Asserting that Atheism and Theism are both faith based positions
How could an airship be repaired midflight?
What is the term when voters “dishonestly” choose something that they do not want to choose?
What should I install to correct "ld: cannot find -lgbm and -linput" so that I can compile a Rust program?
What can I do if I am asked to learn different programming languages very frequently?
How to terminate ping <dest> &
How do hiring committees for research positions view getting "scooped"?
I got the following comment from a reputed math journal. What does it mean?
Brake pads destroying wheels
Print a physical multiplication table
Optimising a list searching algorithm
What (if any) is the reason to buy in small local stores?
What does "^L" mean in C?
Why is there so much iron?
Turning a hard to access nut?
Probably overheated black color SMD pads
Is it insecure to send a password in a `curl` command?
How can an organ that provides biological immortality be unable to regenerate?
What does "Four-F." mean?
In the 1924 version of The Thief of Bagdad, no character is named, right?
Can I use Linear Regression to model a nonlinear function?
Multivariate 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
$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.
regression linear-regression
New contributor
Ahl Ahl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
add a comment |
$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.
regression linear-regression
New contributor
Ahl Ahl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
add a comment |
$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.
regression linear-regression
New contributor
Ahl Ahl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$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
regression linear-regression
New contributor
Ahl Ahl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Ahl Ahl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Ahl Ahl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 2 days ago
Ahl AhlAhl Ahl
61
61
New contributor
Ahl Ahl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Ahl Ahl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Ahl Ahl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
You are asking two different questions:
- 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.
- 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.
$endgroup$
$begingroup$
Thank you for you answer. It made a lot of dark points clearer in my mind!
$endgroup$
– Ahl Ahl
2 days ago
add a comment |
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: "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
);
);
Ahl Ahl is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
$begingroup$
You are asking two different questions:
- 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.
- 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.
$endgroup$
$begingroup$
Thank you for you answer. It made a lot of dark points clearer in my mind!
$endgroup$
– Ahl Ahl
2 days ago
add a comment |
$begingroup$
You are asking two different questions:
- 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.
- 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.
$endgroup$
$begingroup$
Thank you for you answer. It made a lot of dark points clearer in my mind!
$endgroup$
– Ahl Ahl
2 days ago
add a comment |
$begingroup$
You are asking two different questions:
- 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.
- 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.
$endgroup$
You are asking two different questions:
- 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.
- 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.
answered 2 days ago
gentedgented
31718
31718
$begingroup$
Thank you for you answer. It made a lot of dark points clearer in my mind!
$endgroup$
– Ahl Ahl
2 days ago
add a comment |
$begingroup$
Thank you for you answer. It made a lot of dark points clearer in my mind!
$endgroup$
– Ahl Ahl
2 days ago
$begingroup$
Thank you for you answer. It made a lot of dark points clearer in my mind!
$endgroup$
– Ahl Ahl
2 days ago
$begingroup$
Thank you for you answer. It made a lot of dark points clearer in my mind!
$endgroup$
– Ahl Ahl
2 days ago
add a comment |
Ahl Ahl is a new contributor. Be nice, and check out our Code of Conduct.
Ahl Ahl is a new contributor. Be nice, and check out our Code of Conduct.
Ahl Ahl is a new contributor. Be nice, and check out our Code of Conduct.
Ahl Ahl is a new contributor. Be nice, and check out our Code of Conduct.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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