Calculating Logarithmic Regression Step-By-Step | Outlier (2024)

In This Article

  1. What Is a Logarithm?

  2. What Is a Logarithmic Regression?

  3. When Do We Use Logarithmic Regressions?

  4. 3 Types of Logarithmic Regressions

  5. Interpreting Regression Coefficients for Different Logarithmic Regressions

  6. 3 Steps To Calculate Logarithmic Regression

  7. Logarithmic Regression Solved Example

Have you ever wondered how scientists and mathematicians determine the relationship between two variables that don't appear to have a linear relationship? Enter logarithmic regression, a powerful data analysis tool that can help us make sense of complex data.

In this article, we'll explore the basics of logarithmic regression, including how it works, when to use it, and how to interpret the results.

What Is a Logarithm?

A logarithm is a mathematical function that tells you the power to which a base number, bbb, needs to be raised to produce a given value.

logb(bx)=x\log{_b(b^x)}=xlogb(bx)=x

For example, if you want to know the power to which the number 3 needs to be raised to produce the number 81, you would find log3(81)=4log_3(81)=4log3(81)=4. In this case, the log function tells you that 3 must be raised to the power of 4 to get 81.

Logarithmic functions are an inverse function of exponential functions.

Commonly Used Based Numbers

When working with logarithms, you’ll often run into logarithmic functions that use the irrational number eee—also known as Euler’s number—or the number 10 as base numbers.

Natural Logarithms

A logarithm that uses e as a base number is called a natural logarithm. Natural logarithms are often written as ln(x) instead of logexlog_exlogex. Similar to the general form of logarithms, if logea=blog_ea=blogea=b, then =.

Common Logarithms

A logarithmic function that uses 10 as the base number is called a base 10 logarithm or a common logarithm.

What Is a Logarithmic Regression?

Regression is a statistical method we use to study the relationship between a dependent variable, Y, and one or more independent variables, X1nX_{1\sim n}X1n. The dependent variable might also be called a response variable, and the independent variables are often called predictor variables.

The most basic form of regression is a linear regression, where the relationship between the dependent and independent variables is linear i.e., the relationship can be modeled using a straight line.

When the relationship between variables in your data is non-linear, we need to use a nonlinear regression or a modified version of the linear regression model. A logarithmic regression is a modified linear regression that includes one or more logged variables, where “logged variable” simply means taking the logarithm of a variable.

When Do We Use Logarithmic Regressions?

Logarithmic regressions come in handy when your independent and dependent variables follow a nonlinear relationship matching the pattern of decelerating growth or decay. If your dependent variable increases or decreases rapidly at first as the independent variable decreases, but the rate of that increase or decrease gradually slows, you should consider using a logarithmic regression.

Calculating Logarithmic Regression Step-By-Step | Outlier (1)

Using logged variables in your regression lets you capture the non-linear relationship between your variables while maintaining a regression model that is linear in the parameters—or regression coefficients—of the model.

Another case to use a logged variable is when you are dealing with a variable highly skewed (to the right) and follows a distribution called a log-normal distribution. By performing a log transformation on a highly skewed variable, you can convert the variable into one with an approximately normal distribution. In general, if a variable xxx follows a log-normal distribution, then the log of that variable would follow a normal distribution.

3 Types of Logarithmic Regressions

Three types of logarithmic regressions exist. In each type, you take the natural log, ln(x), of one or more of the variables in the regression equation.

1. Linear-log model

In a linear-log model, you perform a log transformation on the independent variable.

Yi=α+βln(Xi)+ϵiY_{i}=\alpha + \beta\ln{(X_{i})}+\epsilon_{i}Yi=α+βln(Xi)+ϵi

2. Log-linear models

In a log-linear model, you perform a log transformation on the dependent variable.

ln(Yi)=α+βXi+ϵi\ln(Y_{i})=\alpha + \beta X_{i}+\epsilon_{i}ln(Yi)=α+βXi+ϵi

3. Log-log models

In a log-log model, you perform a log transformation on both the dependent and independent variables.

ln(Yi)=α+βln(Xi)+ϵi\ln(Y_{i})=\alpha + \beta\ln{(X_{i})}+\epsilon_{i}ln(Yi)=α+βln(Xi)+ϵi

Interpreting Regression Coefficients for Different Logarithmic Regressions

In a simple linear regression, the regression coefficient gives us the estimated change in Y that results from a one-unit change in the independent variable X. The coefficient, in this case, is measured in units of Y, so if equals 3 and Y is measured in dollars, you would interpret the coefficient as: a one-unit increase in X results in a $3.00 increase in Y.

Simple Linear Regression Model

yi^=α^+β^Xi\hat{y_{i}}=\hat{\alpha} + \hat{\beta} X_{i}yi^=α^+β^Xi

In a logarithmic regression, the same logic applies, but the interpretation of the coefficient is somewhat different.

Interpreting B: Linear-log Model

In a linear-log model, like the one shown below, the regression coefficient β\betaβ gives you the estimated change in Y associated with a one-unit increase in ln(X).

Yi=α+βln(Xi)+ϵiY_{i}=\alpha + \beta\ln{(X_{i})}+\epsilon_{i}Yi=α+βln(Xi)+ϵi

While it’s difficult to interpret a one-unit increase in a logged term, a benefit of using logged variables in a regression is that the coefficient can be interpreted in terms of percentage changes. In the linear-log case, we can say that 1a p% increase in X results in an estimated change in Y that equals:

β×ln(100+p100)\beta \times \ln(\dfrac{100+p}{100})β×ln(100100+p)

As an approximation, we can also say that a one-percent increase in X is associated with aβ100\frac{\beta}{100}100β increase in Y.

Interpreting B: Log-linear Model

In a log-linear model, you can interpret the regression coefficient as the estimated percentage change in Y associated with a one-unit increase in X.

In this case, the percentage change is measured on a scale from 0-1. For example, a β\betaβ of 0.12 tells you that Y is estimated to increase by 12% in response to a one-unit increase in X.

Interpreting B: Log-log Model

In a log-log model, we can interpret the regression coefficient as the percentage change in Y that results from a one percent increase in the independent variable.

Unlike the log-linear case, the percentage change in the log-log model is measured on a scale of 0-100. So if β\betaβ=3.5, for example, Y is estimated to increase by 3.5% in response to a 1% increase in X. You will sometimes hear this type of coefficient being called elasticity, since elasticity measures the percentage change in one variable in response to a percentage change in another.

3 Steps To Calculate Logarithmic Regression

Below are steps you can follow to calculate a linear-log model.

Step 1. Enter your data

Suppose you have data on income—measured in thousands of dollars per year—and life expectancy—measured in years. Start by entering or uploading your data into a statistical program like R, Stata, Excel, or Desmos. For this example, we would likely use income to predict life expectancy, so your x-values will be income and your y-values will be life expectancies.

Step 2. Check a scatterplot

Next, plot your data on a scatterplot and check to see whether it’s appropriate to use linear-log model. Remember, logarithmic regression is used in cases where the relationship between X and Y matches the pattern of decelerating growth or decelerating decay.

Step 3. Fit a logarithmic function to your data

Finally, use your software to fit a linear-log function of the form Yi=a+βlnXi Y_i=a+ \beta lnX_iYi=a+βlnXi to your data.

Logarithmic Regression Solved Example

Here is a solved example of how to build the same linear-log regression we ‌discussed using Desmos. To do this, we are using a hypothetical dataset on income and life expectancy.

Step 1. The Data

We start by entering or uploading our data into Desmos as a table with x1x_1x1 representing annual income measured in thousands of dollars and y1y_1y1representing life expectancy in years.

Calculating Logarithmic Regression Step-By-Step | Outlier (2)

Step 2. The Scatterplot

Next, we click on the grey circular icon next to y1y_1y1 in the data table to plot the data points on a scatter plot. We check to see that data is nonlinear and matches the pattern of decelerating growth or decay. In this case, we see that the data seems to match an increasing logarithmic function. Life expectancy increases with age, but it does at a decelerating rate.

Calculating Logarithmic Regression Step-By-Step | Outlier (3)

Step 3. The Regression Results

Finally, we fit a linear-log function to the data by entering the following equation into Demos’ command line: y1b+mln(x1)y_{1}\sim b+m\ln(x_{1})y1b+mln(x1). This will fit a curved line to the data and will show you your regression results.

Calculating Logarithmic Regression Step-By-Step | Outlier (4)

Desmos uses different notation for regressions than what we have used so far. In the Desmos equation, bbb represents the intercept and mmm represents the coefficient on ln(x1)ln(x_1)ln(x1).

The results show that the regression coefficient mmm=8.31395.

Based on what you learned earlier about interpreting coefficients, we can say the following: a one percent increase in income (x1)(x_1)(x1) is associated with a m100\frac{m}{100}100m or 8.31395100\frac{8.31395}{100}1008.31395 increase in life expectancy (y1)(y_1)(y1). Or, as income increases by 1%, our model estimates life expectancy will increase by 0.0831 years.

Calculating Logarithmic Regression Step-By-Step | Outlier (5)

Explore Outlier's Award-Winning For-Credit Courses

Outlier (from the co-founder of MasterClass) has brought together some of the world's best instructors, game designers, and filmmakers to create the future of online college.

Check out these related courses:

Calculating Logarithmic Regression Step-By-Step | Outlier (6)

Intro to Statistics

How data describes our world.

Explore course

Calculating Logarithmic Regression Step-By-Step | Outlier (7)

Intro to Statistics

How data describes our world.

Explore course

Calculating Logarithmic Regression Step-By-Step | Outlier (8)

Intro to Microeconomics

Why small choices have big impact.

Explore course

Calculating Logarithmic Regression Step-By-Step | Outlier (9)

Intro to Microeconomics

Why small choices have big impact.

Explore course

Calculating Logarithmic Regression Step-By-Step | Outlier (10)

Intro to Macroeconomics

How money moves our world.

Explore course

Calculating Logarithmic Regression Step-By-Step | Outlier (11)

Intro to Macroeconomics

How money moves our world.

Explore course

Calculating Logarithmic Regression Step-By-Step | Outlier (12)

Intro to Psychology

The science of the mind.

Explore course

Calculating Logarithmic Regression Step-By-Step | Outlier (13)

Intro to Psychology

The science of the mind.

Explore course
Calculating Logarithmic Regression Step-By-Step | Outlier (2024)

FAQs

What is the formula for log linear regression? ›

∂ logy ∂ logx = ∂y y / ∂x x ≈ %∆y %∆x .

What is a logarithmic regression? ›

Logarithmic regression is used to model situations where growth or decay accelerates rapidly at first and then slows over time. We use the command “LnReg” on a graphing utility to fit a logarithmic function to a set of data points.

What are the 7 steps in regression analysis? ›

LINEAR REGRESSION (In 7 Steps)
  • Step 1: Import the required libraries.
  • Step 2: Read the data using Pandas library.
  • Step 3: Distribute the data into X and Y axis.
  • Step 4: Split the data into train and test set.
  • Step 5: Fit the model and make prediction.
  • Step 6: Visualize the data using matplotlib.
Nov 1, 2020

How to calculate regression by hand? ›

Calculating the Linear Regression

The equation is in the form of “Y = a + bX”. You may also recognize it as the slope formula. To find the linear equation by hand, you need to get the value of “a” and “b”. Then substitute the resulting value in the slope formula and that gives you your linear regression equation.

How to run a log-log regression? ›

At its core, the log log model consists of two equations: one for the dependent variable (Y) and one for the independent variable (X). The equation for Y takes the form of ln(Y) = β0 + β1X1 + β2X2 + ε where β0 is an offset coefficient, X1 and X2 are independent variables, and ε represents variance due to random error.

What is the difference between logistic regression and logarithmic regression? ›

Log-linear models deal with frequency or count data in a contingency table, logistic regression deals with binary outcome data, and multinomial regression deals with categorical outcome data with more than two levels. They also differ in the interpretation and estimation of the parameters.

How does log regression work? ›

Logistic regression is a Machine Learning classification algorithm that is used to predict the probability of certain classes based on some dependent variables. In short, the logistic regression model computes a sum of the input features (in most cases, there is a bias term), and calculates the logistic of the result.

What are the 7 rules of logarithms? ›

What are the 7 Log Rules?
Rule NameLog Rule
Quotient Rulelogb m/n = logb m - logb n
Power Rule of Logarithmlogb mn = n logb m
Change of Base Rulelogb a = (log a) / ( log b)
Number Raised to Logblogbx = x
3 more rows

How do you interpret logarithms in regression? ›

Interpretation of logarithms in a regression. ln(Y)=B0 + B1*ln(X) + u ~ A 1% change in X is associated with a B1% change in Y, so B1 is the elasticity of Y with respect to X. observations, whether they were used in fitting the model or not. generally does this for estimator-specific options (4).

What are the formulas for calculating regression? ›

The simple linear regression line, ^y=a+bx y ^ = a + b x , can be interpreted as follows:
  • ^y is the predicted value of y ,
  • a is the intercept and predicts where the regression line will cross the y -axis,
  • b predicts the change in y for every unit change in x .

What is regression and how is it calculated? ›

A linear regression lets you use one variable to predict another variable's value. Regression line formula. The regression line formula used in statistics is the same used in algebra: y = mx + b.

What are the steps of the regression method? ›

You can build a simple linear regression model in 5 steps.
  1. Collect data. Collect data for two variables (X and Y). ...
  2. Plot the data on a scatter plot. ...
  3. Calculate a correlation coefficient. ...
  4. Fit a regression to the data. ...
  5. Assess the regression line.
Aug 8, 2023

What is the regression formula for dummies? ›

The equation which defines the simplest form of the regression equation with one dependent and one independent variable: y = mx+c. Where y = estimated dependent variable, c = constant, m= regression coefficient and x = independent variable.

References

Top Articles
Maple Sugar Cookies Recipe
Cheeseburger Sliders (Baked Sliders Recipe) - The Cookie Rookie®
Riverrun Rv Park Middletown Photos
Craftsman M230 Lawn Mower Oil Change
Access-A-Ride – ACCESS NYC
Www.metaquest/Device Code
Melfme
What happens if I deposit a bounced check?
South Ms Farm Trader
Marion County Wv Tax Maps
A rough Sunday for some of the NFL's best teams in 2023 led to the three biggest upsets: Analysis - NFL
Mineral Wells Independent School District
How To Cut Eelgrass Grounded
Unit 33 Quiz Listening Comprehension
Connect U Of M Dearborn
Char-Em Isd
Harem In Another World F95
Csi Tv Series Wiki
Foxy Brown 2025
Gopher Hockey Forum
Milanka Kudel Telegram
Lola Bunny R34 Gif
Barber Gym Quantico Hours
Xsensual Portland
Drug Test 35765N
Suspiciouswetspot
Die 8 Rollen einer Führungskraft
Truvy Back Office Login
Anesthesia Simstat Answers
Superhot Free Online Game Unblocked
Airg Com Chat
Ugly Daughter From Grown Ups
The Menu Showtimes Near Amc Classic Pekin 14
Japanese Pokémon Cards vs English Pokémon Cards
Craigs List Jonesboro Ar
Mydocbill.com/Mr
Shih Tzu dogs for sale in Ireland
Bitchinbubba Face
Craigslist Jobs Brownsville Tx
Search All of Craigslist: A Comprehensive Guide - First Republic Craigslist
About My Father Showtimes Near Amc Rockford 16
Cnp Tx Venmo
Weekly Math Review Q2 7 Answer Key
Thor Majestic 23A Floor Plan
Guided Practice Activities 5B-1 Answers
Best Conjuration Spell In Skyrim
Craiglist.nj
Dcuo Wiki
Lake County Fl Trash Pickup Schedule
Inloggen bij AH Sam - E-Overheid
All Obituaries | Roberts Funeral Home | Logan OH funeral home and cremation
Craigslist Centre Alabama
Latest Posts
Article information

Author: Horacio Brakus JD

Last Updated:

Views: 6037

Rating: 4 / 5 (51 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Horacio Brakus JD

Birthday: 1999-08-21

Address: Apt. 524 43384 Minnie Prairie, South Edda, MA 62804

Phone: +5931039998219

Job: Sales Strategist

Hobby: Sculling, Kitesurfing, Orienteering, Painting, Computer programming, Creative writing, Scuba diving

Introduction: My name is Horacio Brakus JD, I am a lively, splendid, jolly, vivacious, vast, cheerful, agreeable person who loves writing and wants to share my knowledge and understanding with you.