Why are incomes and prices right-skewed, and why does a log transform help?
Such values grow by percentages rather than fixed amounts, so many small effects multiply and produce a long right tail (log-normal shape). Taking the log turns multiplication into addition and usually makes the data close to symmetric.
Explain it simply
Salaries rise by 10% hikes, not by Rs 10,000 hikes. Repeated percentage changes multiply. Multiplied effects give a bunch of modest values and a few very large ones: a long right tail. A variable whose logarithm is normal is called log-normal.
Logs also compress big gaps. On a log scale, going from 10,000 to 100,000 looks the same as going from 1 lakh to 10 lakh: each is a tenfold step.
Example
import numpy as np
price = np.array([100, 1000, 10000, 100000])
print(np.log10(price)) # [2. 3. 4. 5.]The raw values span a 1000x range, while the logs sit in an even 2 to 5 range. For modelling, that matters: linear regression assumes errors with roughly constant spread, and house prices on a raw scale violate that. A model on log(price) often fits better, and its coefficients read as approximate percentage effects.
Use np.log1p(x) when the data contains zeros, since log(0) is undefined.
What to say in the interview
"Quantities driven by multiplicative growth, like income, house prices or city populations, are right-skewed and often log-normal. A log transform reduces skew, tames outliers and stabilises variance, which helps linear models and makes histograms readable. Remember to transform predictions back with exp, and the data must be positive."
Common mistakes
- Taking log of zero or negative values without adding a shift or using log1p.