Jump to content

Log transformation (statistics)

From Wikipedia, the free encyclopedia

In statistics, the log transformation is the application of the logarithmic function to each point in a data set—that is, each data point zi is replaced with the transformed value yi = log(zi). The log transform is usually applied so that the data, after transformation, appear to more closely meet the assumptions of a statistical inference procedure that is to be applied, or to improve the interpretability or appearance of graphs.

The log transform is invertible, continuous, and monotonic. The transformation is usually applied to a collection of comparable measurements. For example, if we are working with data on peoples' incomes in some currency unit, it would be common to transform each person's income value by the logarithm function.

Motivation

[edit]

Guidance for how data should be transformed, or whether a transformation should be applied at all, should come from the particular statistical analysis to be performed. For example, a simple way to construct an approximate 95% confidence interval for the population mean is to take the sample mean plus or minus two standard error units. However, the constant factor 2 used here is particular to the normal distribution, and is only applicable if the sample mean varies approximately normally. The central limit theorem states that in many situations, the sample mean does vary normally if the sample size is reasonably large. However, if the population is substantially skewed and the sample size is at most moderate, the approximation provided by the central limit theorem can be poor, and the resulting confidence interval will likely have the wrong coverage probability. Thus, when there is evidence of substantial skew in the data, it is common to transform the data to a symmetric distribution[1] before constructing a confidence interval. If desired, the confidence interval can be constructed for statistics in the original scale, such as the median or the mean, by transforming back to the original scale using exponent (with some adjustments for CI for the mean), the inverse of the log transformation that was applied to the data.[2][3] it is possible to estimate a quantile using different methods, build a CI for it, and then transform these back to the original scale so to have a CI for the quantile in the original scale. For example, it's possible to estimae the location of the median, after the log transformation, using the arithmetic mean. Then build CI for the median using a CI for the mean and transform the CI back to the original scale using exponent. That transformed CI is then a CI for the median, not the mean.

Data can also be transformed to make them easier to visualize. For example, suppose we have a scatterplot in which the points are the countries of the world, and the data values being plotted are the land area and population of each country. If the plot is made using untransformed data (e.g. square kilometers for area and the number of people for population), most of the countries would be plotted in tight cluster of points in the lower left corner of the graph. The few countries with very large areas and/or populations would be spread thinly around most of the graph's area. Simply rescaling units (e.g., to thousand square kilometers, or to millions of people) will not change this. However, following logarithmic transformations of both area and population, the points will be spread more uniformly in the graph.

Another reason for applying thr log data transformation is to improve interpretability, even if no formal statistical analysis or visualization is to be performed.

In regression

[edit]
A scatterplot in which the areas of the sovereign states and dependent territories in the world are plotted on the vertical axis against their populations on the horizontal axis. The upper plot uses raw data. In the lower plot, both the area and population data have been transformed using the logarithm function.

Data transformation may be used as a remedial measure to make data suitable for modeling with linear regression if the original data violates one or more assumptions of linear regression.[4] For example, the simplest linear regression models assume a linear relationship between the expected value of Y (the response variable to be predicted) and each independent variable (when the other independent variables are held fixed). If linearity fails to hold, even approximately, it is sometimes possible to transform either the independent or dependent variables in the regression model to improve the linearity.[5] For example, addition of quadratic functions of the original independent variables may lead to a linear relationship with expected value of Y, resulting in a polynomial regression model, a special case of linear regression.

Another assumption of linear regression is homoscedasticity, that is the variance of errors must be the same regardless of the values of predictors. If this assumption is violated (i.e. if the data is heteroscedastic), it may be possible to find a transformation of Y alone, or transformations of both X (the predictor variables) and Y, such that the homoscedasticity assumption (in addition to the linearity assumption) holds true on the transformed variables[5] and linear regression may therefore be applied on these.

Yet another application of data transformation is to address the problem of lack of normality in error terms. Univariate normality is not needed for least squares estimates of the regression parameters to be meaningful (see Gauss–Markov theorem). However confidence intervals and hypothesis tests will have better statistical properties if the variables exhibit multivariate normality. Transformations that stabilize the variance of error terms (i.e. those that address heteroscedaticity) often also help make the error terms approximately normal.[5][6]

Examples

[edit]

Equation:

Meaning: A unit increase in X is associated with an average of b units increase in Y.

Equation:

(From exponentiating both sides of the equation: )
Meaning: A unit increase in X is associated with an average increase of b units in , or equivalently, Y increases on an average by a multiplicative factor of . For illustrative purposes, if base-10 logarithm were used instead of natural logarithm in the above transformation and the same symbols (a and b) are used to denote the regression coefficients, then a unit increase in X would lead to a times increase in Y on an average. If b were 1, then this implies a 10-fold increase in Y for a unit increase in X

Equation:

Meaning: A k-fold increase in X is associated with an average of units increase in Y. For illustrative purposes, if base-10 logarithm were used instead of natural logarithm in the above transformation and the same symbols (a and b) are used to denote the regression coefficients, then a tenfold increase in X would result in an average increase of units in Y

Equation:

(From exponentiating both sides of the equation: )
Meaning: A k-fold increase in X is associated with a multiplicative increase in Y on an average. Thus if X doubles, it would result in Y changing by a multiplicative factor of .[7]

Relation to other transformations

[edit]

The logarithm transformation is commonly used for positive data. The power transformation is a family of transformations that includes the logarithm, square root, and multiplicative inverse transformations as special cases. It is parameterized by a non-negative value λ and gives the log transformation when λ=0. To approach data transformation systematically, it is possible to use statistical estimation techniques to estimate the parameter λ in the power transformation, thereby identifying the transformation that is approximately the most appropriate in a given setting. Since the power transformation family also includes the identity transformation, this approach can also indicate whether it would be best to analyze the data without a transformation. In regression analysis, this approach is known as the Box–Cox transformation.

Occurrence and applications

[edit]

A common situation where the log transformation is applied is when a value of interest ranges over several orders of magnitude. Many physical and social phenomena exhibit such behavior — incomes, species populations, galaxy sizes, and rainfall volumes, to name a few. Power transforms, and in particular the logarithm, can often be used to induce symmetry in such data. The logarithm is often favored because it is easy to interpret its result in terms of "fold changes".

The logarithm also has a useful effect on ratios. If we are comparing positive quantities X and Y using the ratio X / Y, then if X < Y, the ratio is in the interval (0,1), whereas if X > Y, the ratio is in the half-line (1,∞), where the ratio of 1 corresponds to equality. In an analysis where X and Y are treated symmetrically, the log-ratio log(X / Y) is zero in the case of equality, and it has the property that if X is K times greater than Y, the log-ratio is the equidistant from zero as in the situation where Y is K times greater than X (the log-ratios are log(K) and −log(K) in these two situations).

The log-normal distribution is important in the description of natural phenomena. Many natural growth processes are driven by the accumulation of many small percentage changes which become additive on a log scale. Under appropriate regularity conditions, the distribution of the resulting accumulated changes will be increasingly well approximated by a log-normal, as noted in the section above on "Multiplicative Central Limit Theorem". This is also known as Gibrat's law, after Robert Gibrat (1904–1980) who formulated it for companies.[8] If the rate of accumulation of these small changes does not vary over time, growth becomes independent of size. Even if this assumption is not true, the size distributions at any age of things that grow over time tends to be log-normal.[citation needed] Consequently, reference ranges for measurements in healthy individuals are more accurately estimated by assuming a log-normal distribution than by assuming a symmetric distribution about the mean.[citation needed]

A second justification is based on the observation that fundamental natural laws imply multiplications and divisions of positive variables. Examples are the simple gravitation law connecting masses and distance with the resulting force, or the formula for equilibrium concentrations of chemicals in a solution that connects concentrations of educts and products. Assuming log-normal distributions of the variables involved leads to consistent models in these cases.

Specific examples are given in the following subsections.[9] contains a review and table of log-normal distributions from geology, biology, medicine, food, ecology, and other areas.[10] is a review article on log-normal distributions in neuroscience, with annotated bibliography.

Human behavior

[edit]
  • The length of comments posted in Internet discussion forums follows a log-normal distribution.[11]
  • Users' dwell time on online articles (jokes, news etc.) follows a log-normal distribution.[12]
  • The length of chess games tends to follow a log-normal distribution.[13]
  • Onset durations of acoustic comparison stimuli that are matched to a standard stimulus follow a log-normal distribution.[14]

Biology and medicine

[edit]
  • Measures of size of living tissue (length, skin area, weight).[15]
  • Incubation period of diseases.[16]
  • Diameters of banana leaf spots, powdery mildew on barley.[5]
  • For highly communicable epidemics, such as SARS in 2003, if public intervention control policies are involved, the number of hospitalized cases is shown to satisfy the log-normal distribution with no free parameters if an entropy is assumed and the standard deviation is determined by the principle of maximum rate of entropy production.[17]
  • The length of inert appendages (hair, claws, nails, teeth) of biological specimens, in the direction of growth.[citation needed]
  • The normalised RNA-Seq readcount for any genomic region can be well approximated by log-normal distribution.
  • The PacBio sequencing read length follows a log-normal distribution.[18]
  • Certain physiological measurements, such as blood pressure of adult humans (after separation on male/female subpopulations).[19]
  • Several pharmacokinetic variables, such as Cmax, elimination half-life and the elimination rate constant.[20]
  • In neuroscience, the distribution of firing rates across a population of neurons is often approximately log-normal. This has been first observed in the cortex and striatum [21] and later in hippocampus and entorhinal cortex,[22] and elsewhere in the brain.[10][23] Also, intrinsic gain distributions and synaptic weight distributions appear to be log-normal[24] as well.
  • Neuron densities in the cerebral cortex, due to the noisy cell division process during neurodevelopment.[25]
  • In operating-rooms management, the distribution of surgery duration.
  • In the size of avalanches of fractures in the cytoskeleton of living cells, showing log-normal distributions, with significantly higher size in cancer cells than healthy ones.[26]

Chemistry

[edit]
Fitted cumulative log-normal distribution to annually maximum 1-day rainfalls, see distribution fitting

Hydrology

[edit]
  • In hydrology, the log-normal distribution is used to analyze extreme values of such variables as monthly and annual maximum values of daily rainfall and river discharge volumes.[28]
The image on the right, made with CumFreq, illustrates an example of fitting the log-normal distribution to ranked annually maximum one-day rainfalls showing also the 90% confidence belt based on the binomial distribution.[29]
The rainfall data are represented by plotting positions as part of a cumulative frequency analysis.

Social sciences and demographics

[edit]
  • In economics, there is evidence that the income of 97%–99% of the population is distributed log-normally.[30] (The distribution of higher-income individuals follows a Pareto distribution).[31]
  • If an income distribution follows a log-normal distribution with standard deviation , then the Gini coefficient, commonly use to evaluate income inequality, can be computed as where is the error function, since , where is the cumulative distribution function of a standard normal distribution.
  • In finance, in particular the Black–Scholes model, changes in the logarithm of exchange rates, price indices, and stock market indices are assumed normal[32] (these variables behave like compound interest, not like simple interest, and so are multiplicative). However, some mathematicians such as Benoit Mandelbrot have argued [33] that log-Lévy distributions, which possesses heavy tails would be a more appropriate model, in particular for the analysis for stock market crashes. Indeed, stock price distributions typically exhibit a fat tail.[34] The fat tailed distribution of changes during stock market crashes invalidate the assumptions of the central limit theorem.
  • In scientometrics, the number of citations to journal articles and patents follows a discrete log-normal distribution.[35][36]
  • City sizes (population) satisfy Gibrat's Law.[37] The growth process of city sizes is proportionate and invariant with respect to size. From the central limit theorem therefore, the log of city size is normally distributed.
  • The number of sexual partners appears to be best described by a log-normal distribution.[38]

Technology

[edit]
  • In reliability analysis, the log-normal distribution is often used to model times to repair a maintainable system.[39]
  • In wireless communication, "the local-mean power expressed in logarithmic values, such as dB or neper, has a normal (i.e., Gaussian) distribution."[40] Also, the random obstruction of radio signals due to large buildings and hills, called shadowing, is often modeled as a log-normal distribution.
  • Particle size distributions produced by comminution with random impacts, such as in ball milling.[41]
  • The file size distribution of publicly available audio and video data files (MIME types) follows a log-normal distribution over five orders of magnitude.[42]
  • File sizes of 140 million files on personal computers running the Windows OS, collected in 1999.[43][11]
  • Sizes of text-based emails (1990s) and multimedia-based emails (2000s).[11]
  • In computer networks and Internet traffic analysis, log-normal is shown as a good statistical model to represent the amount of traffic per unit time. This has been shown by applying a robust statistical approach on a large groups of real Internet traces. In this context, the log-normal distribution has shown a good performance in two main use cases: (1) predicting the proportion of time traffic will exceed a given level (for service level agreement or link capacity estimation) i.e. link dimensioning based on bandwidth provisioning and (2) predicting 95th percentile pricing.[44]
  • in physical testing when the test produces a time-to-failure of an item under specified conditions, the data is often best analyzed using a lognormal distribution.[45][46]

See also

[edit]

References

[edit]
  1. ^ Kuhn, Max; Johnson, Kjell (2013). Applied predictive modeling. New York: Springer. doi:10.1007/978-1-4614-6849-3. ISBN 9781461468493. LCCN 2013933452. OCLC 844349710. S2CID 60246745.
  2. ^ Altman, Douglas G.; Bland, J. Martin (1996-04-27). "Statistics notes: Transformations, means, and confidence intervals". BMJ. 312 (7038): 1079. doi:10.1136/bmj.312.7038.1079. ISSN 0959-8138. PMC 2350916. PMID 8616417.
  3. ^ "Data transformations - Handbook of Biological Statistics". www.biostathandbook.com. Retrieved 2019-03-19.
  4. ^ "Lesson 9: Data Transformations | STAT 501". newonlinecourses.science.psu.edu. Retrieved 2019-03-17.
  5. ^ a b c d e Kutner, Michael H.; Nachtsheim, Christopher J.; Neter, John; Li, William (2005). Applied linear statistical models (5th ed.). Boston: McGraw-Hill Irwin. pp. 129–133. ISBN 0072386886. LCCN 2004052447. OCLC 55502728.
  6. ^ Altman, Douglas G.; Bland, J. Martin (1996-03-23). "Statistics Notes: Transforming data". BMJ. 312 (7033): 770. doi:10.1136/bmj.312.7033.770. ISSN 0959-8138. PMC 2350481. PMID 8605469.
  7. ^ "9.3 - Log-transforming Both the Predictor and Response | STAT 501". newonlinecourses.science.psu.edu. Retrieved 2019-03-17.
  8. ^ Sutton, John (Mar 1997). "Gibrat's Legacy". Journal of Economic Literature. 32 (1): 40–59. JSTOR 2729692.
  9. ^ Limpert, Eckhard; Stahel, Werner A.; Abbt, Markus (2001). "Log-normal Distributions across the Sciences: Keys and Clues". BioScience. 51 (5): 341. doi:10.1641/0006-3568(2001)051[0341:LNDATS]2.0.CO;2. ISSN 0006-3568.
  10. ^ a b Buzsáki, György; Mizuseki, Kenji (2017-01-06). "The log-dynamic brain: how skewed distributions affect network operations". Nature Reviews. Neuroscience. 15 (4): 264–278. doi:10.1038/nrn3687. ISSN 1471-003X. PMC 4051294. PMID 24569488.
  11. ^ a b c Pawel, Sobkowicz; et al. (2013). "Lognormal distributions of user post lengths in Internet discussions - a consequence of the Weber-Fechner law?". EPJ Data Science.
  12. ^ Yin, Peifeng; Luo, Ping; Lee, Wang-Chien; Wang, Min (2013). Silence is also evidence: interpreting dwell time for recommendation from psychological perspective. ACM International Conference on KDD.
  13. ^ "What is the average length of a game of chess?". chess.stackexchange.com. Retrieved 14 April 2018.
  14. ^ Heil P, Friedrich B (2017). "Onset-Duration Matching of Acoustic Stimuli Revisited: Conventional Arithmetic vs. Proposed Geometric Measures of Accuracy and Precision". Frontiers in Psychology. 7: 2013. doi:10.3389/fpsyg.2016.02013. PMC 5216879. PMID 28111557.
  15. ^ Huxley, Julian S. (1932). Problems of relative growth. London. ISBN 978-0-486-61114-3. OCLC 476909537. {{cite book}}: ISBN / Date incompatibility (help)
  16. ^ Sartwell, Philip E. "The distribution of incubation periods of infectious disease." American journal of hygiene 51 (1950): 310-318.
  17. ^ S. K. Chan, Jennifer; Yu, Philip L. H. (2006). "Modelling SARS data using threshold geometric process". Statistics in Medicine. 25 (11): 1826–1839. doi:10.1002/sim.2376. PMID 16345017. S2CID 46599163.
  18. ^ Ono, Yukiteru; Asai, Kiyoshi; Hamada, Michiaki (2013-01-01). "PBSIM: PacBio reads simulator—toward accurate genome assembly". Bioinformatics. 29 (1): 119–121. doi:10.1093/bioinformatics/bts649. ISSN 1367-4803. PMID 23129296.
  19. ^ Makuch, Robert W.; D.H. Freeman; M.F. Johnson (1979). "Justification for the lognormal distribution as a model for blood pressure". Journal of Chronic Diseases. 32 (3): 245–250. doi:10.1016/0021-9681(79)90070-5. PMID 429469.
  20. ^ Lacey, L. F.; Keene, O. N.; Pritchard, J. F.; Bye, A. (1997-01-01). "Common noncompartmental pharmacokinetic variables: are they normally or log-normally distributed?". Journal of Biopharmaceutical Statistics. 7 (1): 171–178. doi:10.1080/10543409708835177. ISSN 1054-3406. PMID 9056596.
  21. ^ Scheler, Gabriele; Schumann, Johann (2006-10-08). Diversity and stability in neuronal output rates. 36th Society for Neuroscience Meeting, Atlanta.
  22. ^ Mizuseki, Kenji; Buzsáki, György (2013-09-12). "Preconfigured, skewed distribution of firing rates in the hippocampus and entorhinal cortex". Cell Reports. 4 (5): 1010–1021. doi:10.1016/j.celrep.2013.07.039. ISSN 2211-1247. PMC 3804159. PMID 23994479.
  23. ^ Wohrer, Adrien; Humphries, Mark D.; Machens, Christian K. (2013-04-01). "Population-wide distributions of neural activity during perceptual decision-making". Progress in Neurobiology. 103: 156–193. doi:10.1016/j.pneurobio.2012.09.004. ISSN 1873-5118. PMC 5985929. PMID 23123501.
  24. ^ Scheler, Gabriele (2017-07-28). "Logarithmic distributions prove that intrinsic learning is Hebbian". F1000Research. 6: 1222. doi:10.12688/f1000research.12130.2. PMC 5639933. PMID 29071065.
  25. ^ Morales-Gregorio, Aitor; van Meegen, Alexander; van Albada, Sacha (2023). "Ubiquitous lognormal distribution of neuron densities in mammalian cerebral cortex". Cerebral Cortex. 33 (16): 9439–9449. doi:10.1093/cercor/bhad160. PMC 10438924. PMID 37409647.
  26. ^ Polizzi, Stefano; Laperrousaz, Bastien; Perez-Reche, Francisco J; Nicolini, Franck E; Satta, Véronique Maguer; Arneodo, Alain; Argoul, Françoise (2018-05-29). "A minimal rupture cascade model for living cell plasticity". New Journal of Physics. 20 (5): 053057. doi:10.1088/1367-2630/aac3c7. hdl:2164/10561. ISSN 1367-2630.
  27. ^ Ahrens, L. H. (1954-02-01). "The lognormal distribution of the elements (A fundamental law of geochemistry and its subsidiary)". Geochimica et Cosmochimica Acta. 5 (2): 49–73. Bibcode:1954GeCoA...5...49A. doi:10.1016/0016-7037(54)90040-X. ISSN 0016-7037.
  28. ^ Oosterbaan, R.J. (1994). "6: Frequency and Regression Analysis" (PDF). In Ritzema, H.P. (ed.). Drainage Principles and Applications, Publication 16. Wageningen, The Netherlands: International Institute for Land Reclamation and Improvement (ILRI). pp. 175–224. ISBN 978-90-70754-33-4.
  29. ^ CumFreq, free software for distribution fitting
  30. ^ Clementi, Fabio; Gallegati, Mauro (2005) "Pareto's law of income distribution: Evidence for Germany, the United Kingdom, and the United States", EconWPA
  31. ^ Wataru, Souma (2002-02-22). "Physics of Personal Income". In Takayasu, Hideki (ed.). Empirical Science of Financial Fluctuations: The Advent of Econophysics. Springer. arXiv:cond-mat/0202388. doi:10.1007/978-4-431-66993-7.
  32. ^ Black, F.; Scholes, M. (1973). "The Pricing of Options and Corporate Liabilities". Journal of Political Economy. 81 (3): 637. doi:10.1086/260062. S2CID 154552078.
  33. ^ Mandelbrot, Benoit (2004). The (mis-)Behaviour of Markets. Basic Books. ISBN 9780465043552.
  34. ^ Bunchen, P., Advanced Option Pricing, University of Sydney coursebook, 2007
  35. ^ Thelwall, Mike; Wilson, Paul (2014). "Regression for citation data: An evaluation of different methods". Journal of Informetrics. 8 (4): 963–971. arXiv:1510.08877. doi:10.1016/j.joi.2014.09.011. S2CID 8338485.
  36. ^ Sheridan, Paul; Onodera, Taku (2020). "A Preferential Attachment Paradox: How Preferential Attachment Combines with Growth to Produce Networks with Log-normal In-degree Distributions". Scientific Reports. 8 (1): 2811. arXiv:1703.06645. doi:10.1038/s41598-018-21133-2. PMC 5809396. PMID 29434232.
  37. ^ Eeckhout, Jan (2004). "Gibrat's Law for (All) Cities". American Economic Review. 94 (5): 1429–1451. doi:10.1257/0002828043052303. JSTOR 3592829 – via JSTOR.
  38. ^ Kault, David (1996). "The Shape of the Distribution of the Number of Sexual Partners". Statistics in Medicine. 15 (2): 221–230. doi:10.1002/(SICI)1097-0258(19960130)15:2<221::AID-SIM148>3.0.CO;2-Q. PMID 8614756.
  39. ^ O'Connor, Patrick; Kleyner, Andre (2011). Practical Reliability Engineering. John Wiley & Sons. p. 35. ISBN 978-0-470-97982-2.
  40. ^ "Shadowing". www.WirelessCommunication.NL. Archived from the original on January 13, 2012.
  41. ^ Dexter, A. R.; Tanner, D. W. (July 1972). "Packing Densities of Mixtures of Spheres with Log-normal Size Distributions". Nature Physical Science. 238 (80): 31–32. Bibcode:1972NPhS..238...31D. doi:10.1038/physci238031a0. ISSN 2058-1106.
  42. ^ Gros, C; Kaczor, G.; Markovic, D (2012). "Neuropsychological constraints to human data production on a global scale". The European Physical Journal B. 85 (28): 28. arXiv:1111.6849. Bibcode:2012EPJB...85...28G. doi:10.1140/epjb/e2011-20581-3. S2CID 17404692.
  43. ^ Douceur, John R.; Bolosky, William J. (1999-05-01). "A large-scale study of file-system contents". ACM SIGMETRICS Performance Evaluation Review. 27 (1): 59–70. doi:10.1145/301464.301480. ISSN 0163-5999.
  44. ^ Alamsar, Mohammed; Parisis, George; Clegg, Richard; Zakhleniuk, Nickolay (2019). "On the Distribution of Traffic Volumes in the Internet and its Implications". arXiv:1902.03853 [cs.NI].
  45. ^ ASTM D3654, Standard Test Method for Shear Adhesion on Pressure-Sensitive Tapesw
  46. ^ ASTM D4577, Standard Test Method for Compression Resistance of a container Under Constant Load>\
[edit]