Log–log plot: Difference between revisions

Content deleted Content added
AnomieBOT (talk | contribs)
m Dating maintenance tags: {{More citations needed}}
 
(16 intermediate revisions by 9 users not shown)
Line 1:
{{Short description|2D graphic with logarithmic scales on both axes}}
{{More citations needed|log graph papers and their use|find=https://www.mathnstuff.com/math/spoken/here/2class/340/loggraf.htm|date=August 2025|name=Agnes (A<sup>2</sup>) Azzolino}}
{{More citations needed|date=December 2009}}
[[Image:LogLog exponentials.svg|class=skin-invert-image|thumb|A log–log plot of ''y''&nbsp;=&nbsp;''x''&nbsp;(blue), ''y''&nbsp;=&nbsp;''x''<sup>2</sup>&nbsp;(green), and ''y''&nbsp;=&nbsp;''x''<sup>3</sup>&nbsp;(red).<br>Note the logarithmic scale markings on each of the axes, and that the log&nbsp;''x'' and log&nbsp;''y'' axes (where the logarithms are 0) are where ''x'' and ''y'' themselves are 1.]]
 
[[File:Comparison of simple power law curves in original and log-log scale.png|thumb|Comparison of Linear, Concave, and Convex Functions\nIn original (left) and log10 (right) scales]]
 
[[File:Comparison of simple power law curves in original and log-log scale.png|class=skin-invert-image|thumb|Comparison of Linearlinear, Concaveconcave, and Convexconvex Functions\nInfunctions originalwhen plotted using a linear scale (left) andor log10a log scale (right) scales.]]
[[File:Loglog graph paper.gif|thumb|blank log-log graph paper]]
In [[science]] and [[engineering]], a '''log–log graph''' or '''log–log plot''' is a two-dimensional graph of numerical data that uses [[logarithmic scale]]s on both the horizontal and vertical axes. [[Exponentiation#Power_functions|Power functions]] – relationships of the form <math>y=ax^k</math> – appear as straight lines in a log–log graph, with the exponent corresponding to the slope, and the coefficient corresponding to the intercept. Thus these graphs are very useful for recognizing these relationships and [[estimating parameters]]. Any base can be used for the logarithm, though most commonly base 10 (common logs) are used.
 
Line 14:
<math display="block">Y = mX + b</math>
 
where ''m''&nbsp;=&nbsp;''k'' is the slope of the line ([[Grade (slope)|gradient]]) and ''b''&nbsp;=&nbsp;log&nbsp;''a'' is the intercept on the (log&nbsp;''y'')-axis, meaning where log&nbsp;''x''&nbsp;=&nbsp;0, so, reversing the logs, ''a'' is the ''y'' value corresponding to ''x''&nbsp;=&nbsp;1.<ref>[http{{Cite web |last=Bourne |first=Murray |title=7. Log-Log and Semi-log Graphs |url=https://www.intmath.com/Exponentialexponential-logarithmic-functions/7_Graphs7-graphs-log-semilog.php M. Bourne ''Graphs on Logarithmic and Semi|access-Logarithmic Paper''date=2024-10-15 (|website=www.intmath.com)] |language=en-us}}</ref>
 
== Equations ==
Line 23:
 
=== Slope of a log–log plot ===
[[Image:Slope of log-log plot.PNG|class=skin-invert-image|thumbnail|250px|Finding the slope of a log–log plot using ratios]]
To find the slope of the plot, two points are selected on the ''x''-axis, say ''x''<sub>1</sub> and ''x''<sub>2</sub>. Using the abovebelow equation:
<math display="block"> \log[F (x_1)] = m \log (x_1) + b, </math>
and
Line 79:
A_{(m=-1)} &= F_0 \cdot x_0 \cdot \ln \frac{x_1}{x_0}
\end{align}</math>
 
== Log-log linear regression models ==
 
Log–log plots are often use for visualizing log-log linear regression models with (roughly) [[log-normal]], or [[Log-logistic distribution|Log-logistic]], errors. In such models, after log-transforming the dependent and independent variables, a [[Simple linear regression]] model can be fitted, with the errors becoming [[Homoscedasticity|homoscedastic]]. This model is useful when dealing with data that exhibits exponential growth or decay, while the errors continue to grow as the independent value grows (i.e., [[heteroscedasticity|heteroscedastic]] error).
 
As above, in a log-log linear model the relationship between the variables is expressed as a power law. Every unit change in the independent variable will result in a constant percentage change in the dependent variable. The model is expressed as:
 
:<math>y = a \cdot x^b \cdot e^\epsilon</math>
 
Taking the logarithm of both sides, we get:
 
:<math>\log(y) = \log(a) + b \cdot \log(x) + \epsilon</math>
 
This is a [[linear equation]] in the logarithms of <math>x</math> and <math>y</math>, with <math>\log(a)</math> as the intercept and <math>b</math> as the slope. In which <math>\epsilon \sim \textrm{Normal}(\mu, \sigma^2)</math>, and <math>e^\epsilon \sim \textrm{Log-Normal}(\mu, \sigma^2)</math>.
 
[[File:Visualizing Loglog Normal Data.png|class=skin-invert-image|thumb|Figure 1: Visualizing Loglog Normal Data]]
 
Figure 1 illustrates how this looks. It presents two plots generated using 10,000 simulated points. The left plot, titled 'Concave Line with Log-Normal Noise', displays a [[scatter plot]] of the observed data (y) against the independent variable (x). The red line represents the 'Median line', while the blue line is the 'Mean line'. This plot illustrates a dataset with a power-law relationship between the variables, represented by a concave line.
 
When both variables are log-transformed, as shown in the right plot of Figure 1, titled 'Log-Log Linear Line with Normal Noise', the relationship becomes linear. This plot also displays a scatter plot of the observed data against the independent variable, but after both axes are on a logarithmic scale. Here, both the mean and median lines are the same (red) line. This transformation allows us to fit a [[Simple linear regression]] model (which can then be transformed back to the original scale - as the median line).
 
[[File:Sliding Window Error Metrics Loglog Normal Data.png|class=skin-invert-image|thumb|Figure 2: Sliding Window Error Metrics Loglog Normal Data]]
 
The transformation from the left plot to the right plot in Figure 1 also demonstrates the effect of the log transformation on the distribution of noise in the data. In the left plot, the noise appears to follow a [[log-normal distribution]], which is right-skewed and can be difficult to work with. In the right plot, after the log transformation, the noise appears to follow a [[normal distribution]], which is easier to reason about and model.
 
This normalization of noise is further analyzed in Figure 2, which presents a line plot of three error metrics ([[Mean Absolute Error]] - MAE, [[Root Mean Square Error]] - RMSE, and [[Mean Absolute Logarithmic Error]] - MALE) calculated over a sliding window of size 28 on the x-axis. The y-axis gives the error, plotted against the independent variable (x). Each error metric is represented by a different color, with the corresponding smoothed line overlaying the original line (since this is just simulated data, the error estimation is a bit jumpy). These error metrics provide a measure of the noise as it varies across different x values.
 
Log-log linear models are widely used in various fields, including economics, biology, and physics, where many phenomena exhibit power-law behavior. They are also useful in [[regression analysis]] when dealing with heteroscedastic data, as the log transformation can help to stabilize the variance.
 
== Applications ==
[[File:2010- Decreasing renewable energy costs versus deployment.svg|class=skin-invert-image|thumb|upright=1.3|A log-log plot condensing information that spans more than one order of magnitude along both axes]]
These graphs are useful when the parameters ''a'' and ''b'' need to be estimated from numerical data. Specifications such as this are used frequently in [[economics]].
 
Line 113 ⟶ 141:
* [[Zipf law]]
* [[Log-linear model]]
* [[Log-normal distribution]]
* [[Log-logistic distribution]]
* [[Data transformation (statistics)]]
* [[Variance-stabilizing transformation]]
 
== References ==