The difference between linear and nonlinear regression models isn’t as straightforward as it sounds. You’d think that linear equations produce straight lines and nonlinear equations model curvature. Unfortunately, that’s *not* correct. Both types of models can fit curves to your data—so that’s not the defining characteristic. In this post, I’ll teach you how to identify linear and nonlinear regression models.

The difference between nonlinear and linear is the “non.” OK, that sounds like a joke, but, honestly, that’s the easiest way to understand the difference. First, I’ll define what linear regression is, and then everything else must be nonlinear regression. I’ll include examples of both linear and nonlinear regression models.

## Linear Regression Equations

A linear regression model follows a very particular form. In statistics, a regression model is linear when all terms in the model are one of the following:

- The constant
- A parameter multiplied by an independent variable (IV)

Then, you build the equation by only adding the terms together. These rules limit the form to just one type:

Dependent variable = constant + parameter * IV + … + parameter * IV

Statisticians say that this type of regression equation is linear in the parameters. However, it is possible to model curvature with this type of model. While the function must be linear in the parameters, you can raise an independent variable by an exponent to fit a curve. For example, if you square an independent variable, the model can follow a U-shaped curve.

While the independent variable is squared, the model is still linear in the parameters. Linear models can also contain log terms and inverse terms to follow different kinds of curves and yet continue to be linear in the parameters.

The regression example below models the relationship between body mass index (BMI) and body fat percent. In a different blog post, I use this model to show how to make predictions with regression analysis. It is a linear model that uses a quadratic (squared) term to model the curved relationship.

## Nonlinear Regression Equations

I showed how linear regression models have one basic configuration. Now, we’ll focus on the “non” in nonlinear! If a regression equation doesn’t follow the rules for a linear model, then it must be a nonlinear model. It’s that simple! A nonlinear model is literally not linear.

The added flexibility opens the door to a huge number of possible forms. Consequently, nonlinear regression can fit an enormous variety of curves. However, because there are so many candidates, you may need to conduct some research to determine which functional form provides the best fit for your data.

Below, I present a handful of examples that illustrate the diversity of nonlinear regression models. Keep in mind that each function can fit a variety of shapes, and there are many nonlinear functions. Also, notice how nonlinear regression equations are not comprised of only addition and multiplication! In the table, thetas are the parameters, and Xs are the independent variables.

**Nonlinear equation**

**Example form**

The nonlinear regression example below models the relationship between density and electron mobility.

The equation for the nonlinear regression analysis is too long for the fitted line plot:

Electron Mobility = (1288.14 + 1491.08 * Density Ln + 583.238 * Density Ln^2 + 75.4167 * Density Ln^3) / (1 + 0.966295 * Density Ln + 0.397973 * Density Ln^2 + 0.0497273 * Density Ln^3)

It’s important to note that R-squared is invalid for nonlinear models and statistical software can’t calculate p-values for the terms.

The defining characteristic for both types of models are the functional forms. If you can focus on the form that represents a linear model, it’s easy enough to remember that anything else must be a nonlinear. Now that you understand the differences between the two types of regression models, learn more about fitting curves and choosing between them in the following blog posts!

- How to Choose Between Linear and Nonlinear Regression
- Curve Fitting using Linear and Nonlinear Regression

If you’re learning regression, check out my Regression Tutorial!

**Note: I wrote a different version of this post that appeared elsewhere. I’ve completely rewritten and updated it for my blog site.**

Amir says

Dear Jim,

The way you teach statistics is exclusive! It comes from deep experience, and this makes people to bypass all the fear and fuss around mathematical expressions – which were developed to explain the world around us. As Einstein said, “if you can not explain it simple you have not understand well”. Thanks for explaining simple and thanks for understanding statistics well.

Amir

Jim Frost says

Hi Amir, thank you so much for your kind words–that means a lot to me! I strongly believe that statistics doesn’t have to be scary! I’m happy that you have found my posts helpful. By the way, that’s a great quote from Einstein! –Jim

Alee says

Hello Sir!

if the property values is dependent variable and (house characteristics including, no of beds rooms, larger area, green spaces near to home and other amenities) are independent variables, how can we apply liner and non linear regression on them?

Jim Frost says

High Alee!

Long, long ago I had a professor who published a study about this exact subject! By the way, he found that the single thing a homeowner could do to increase the value of their home is to use add a bathroom! He used linear regression for his analysis.

As for how to perform this analysis, you simply use the sale prices as the dependent variable. And, you include all of the house characteristics as independent variables. In this manner, you can see how changes in the independent variables relate to changes in the average sale price of a home. For example, you can see how the average sales price changes when you add a square foot or add a bathroom!

I hope this helps!

Alisha Bansal says

Hi Jim, found this article very helpful. Many many thanks for posting this!

jw says

Hey Jim,

I was just researching this topic and found a similar article elsewhere.

The time stamp on your article is older so I hope that they were copying from you and not the other way around. I just wanted to let you know about this, maybe you already did ðŸ™‚

Cheers

Jim Frost says

Hi JW,

Thanks so much for pointing this out to me. Everything is OK because I am the author of both. I actually completely rewrote these articles so the text is different. They’re basically different articles on the same topic. In fact, if you use the Internet Archive Wayback Machine and look at older versions, you’ll see that I am listed as the author. For unknown reasons, the organization removed most authors’ names from their blog posts.

Thanks again!

Natalie says

You have helped me understand statistics!!!! Thank you

Jim Frost says

You’re very welcome! I’m happy to hear that my website has helped you with statistics!

Ashutosh Kumar says

Dear Jim,

I have read a couple of your articles now and sharing it around as well and they are really very helpful and easy to interpret. Thank you for this !!

With regards to this post, my question is that – In cases when we use a higher order polynomial term in the linear regression model, to mode the curvature, does this not fail the multicollinearity assumption because now we cannot change the value of x keeping x^2 constant?

Jim Frost says

Hi Ashutosh,

Thank you so much for you kind words! And, thanks for sharing my articles. I really appreciate that!

Yes! You’re pretty much correct with that. However, the assumption only excludes perfect correlation. Some degree of correlation is OK but if it increases too much it becomes problematic. For information about the assumptions (including this one), read my post about the classical OLS assumptions.

In terms of polynomials specifically, yes, these terms often increase multicollinearity to problematic levels. To correct for this type of multicollinearity, you can center the continuous variables. Read about this approach in my post about multicollinearity. This method typically reduces multicollinearity caused by polynomials to acceptable levels.

I hope this helps!

shashi says

How you decide to use linear regression or non linear regression ?

Jim Frost says

Hi Shashi,

I wrote a blog post about this topic specifically! How to Choose Between Linear and Nonlinear Regression.

I also talk about it in a post about curve fitting.

Read those two posts and you’ll have your answer!