Questions tagged [logarithm]

The logarithm of a number is the power to which the base must be raised to get the number.

The logarithm of a number is the power to which the base must be raised to get the number. Although the full name is 'logarithm', people often just say 'log' instead. The base can be any real number, but two values are most typical. When the base is $10$, we say we are using the 'common log'. On the other hand, when the base is $e$ ($\approx 2.718281828$), we say we are using the 'natural log'. The natural log can be mathematically convenient, whereas the common log is more intuitive for many people because every increment is $10\times$ greater than the previous value.

572 questions
222
votes
4 answers

When (and why) should you take the log of a distribution (of numbers)?

Say I have some historical data e.g., past stock prices, airline ticket price fluctuations, past financial data of the company... Now someone (or some formula) comes along and says "let's take/use the log of the distribution" and here's where I go…
PhD
  • 13,429
  • 19
  • 45
  • 47
204
votes
8 answers

In linear regression, when is it appropriate to use the log of an independent variable instead of the actual values?

Am I looking for a better behaved distribution for the independent variable in question, or to reduce the effect of outliers, or something else?
d_2
  • 2,191
  • 3
  • 14
  • 5
68
votes
4 answers

Why is it that natural log changes are percentage changes? What is about logs that makes this so?

Can somebody explain how the properties of logs make it so you can do log linear regressions where the coefficients are interpreted as percentage changes?
thewhitetie
  • 837
  • 1
  • 7
  • 6
54
votes
3 answers

Interpretation of log transformed predictor and/or response

I'm wondering if it makes a difference in interpretation whether only the dependent, both the dependent and independent, or only the independent variables are log transformed. Consider the case of log(DV) = Intercept + B1*IV + Error I can…
31
votes
4 answers

Why are log probabilities useful?

Probabilities of a random variable's observations are in the range $[0,1]$, whereas log probabilities transform them to the log scale. What then is the corresponding range of log probabilities, i.e. what does a probability of 0 become, and is it the…
develarist
  • 3,009
  • 8
  • 31
28
votes
6 answers

What are alternatives to broken axes?

Users are often tempted to break axis values to present data of different orders of magnitude on the same graph (see here). While this may be convenient it's not always the preferred way of displaying the data (can be misleading at best). What are…
Roman Luštrik
  • 3,338
  • 3
  • 31
  • 39
27
votes
6 answers

In statistics, should I assume $\log$ to mean $\log_{10}$ or the natural logarithm $\ln$?

I'm studying statistics and often come across formulae containing the log and I'm always confused if I should interpret that as the standard meaning of log, i.e. base 10, or if in statistics the symbol log is generally assumed to be the natural log…
Giuseppe Romagnuolo
  • 475
  • 1
  • 4
  • 11
24
votes
1 answer

Expected value and variance of log(a)

I have a random variable $X(a) = \log(a)$ where a is normal distributed $\mathcal N(\mu,\sigma^2)$. What can I say about $E(X)$ and $Var(X)$? An approximation would be helpful too.
24
votes
2 answers

Why log-transforming the data before performing principal component analysis?

Im following a tutorial here: http://www.r-bloggers.com/computing-and-visualizing-pca-in-r/ to gain a better understanding of PCA. The tutorial uses the Iris dataset and applies a log transform prior to PCA: Notice that in the following code we…
Marc van der Peet
  • 283
  • 1
  • 3
  • 5
21
votes
5 answers

What is the intuitive meaning of having a linear relationship between the logs of two variables?

I have two variables which don't show much correlation when plotted against each other as is, but a very clear linear relationship when I plot the logs of each variable agains the other. So I would end up with a model of the type: $$\log(Y) = a…
Akaike's Children
  • 1,251
  • 7
  • 15
20
votes
1 answer

Log probability vs product of probabilities

According to this wikipedia article, one can represent the product of probabilities x⋅y as -log(x) - log(y) making the computation more computationally optimal. But if I try an example say: p1 = 0.5 p2 = 0.5 p1 * p2 = 0.25 -log(p1) - log(p2) = 2 p3…
spacemonkey
  • 365
  • 1
  • 2
  • 7
16
votes
2 answers

Skewness of the logarithm of a gamma random variable

Consider gamma random variable $X\sim\Gamma(\alpha, \theta)$. There are neat formulas for the mean, variance, and skewness: \begin{align} \mathbb E[X]&=\alpha\theta\\ \operatorname{Var}[X]&=\alpha\theta^2=1/\alpha\cdot\mathbb…
amoeba
  • 93,463
  • 28
  • 275
  • 317
16
votes
2 answers

How to transform negative values to logarithms?

I would like to know how to transform negative values to Log(), since I have heteroskedastic data. I read that it works with the formula Log(x+1) but this doesn't work with my database and I continue getting NaNs as result. E.g. I get this Warning…
Darwin PC
  • 459
  • 2
  • 4
  • 10
16
votes
1 answer

do logs modify the correlation between two variables?

I am applying logs to two very skewed variables and then doing the correlation. Before logs the correlation is 0.49 and after logs it is 0.9. I thought the logs only change the scale. How is this possible? Here below the graphs for each of them.…
DroppingOff
  • 487
  • 1
  • 4
  • 12
14
votes
2 answers

Binary Models (Probit and Logit) with a Logarithmic Offset

Does anyone have a derivation of how an offset works in binary models like probit and logit? In my problem, the follow-up window can vary in length. Suppose patients get a prophylactic shot as treatment. The shot happens at different times, so if…
dimitriy
  • 31,081
  • 5
  • 63
  • 138
1
2 3
38 39