Skip to main content
deleted 56 characters in body
Source Link
kjetil b halvorsen
  • 82.8k
  • 32
  • 201
  • 663
set.seed(720); n = 10^4
x2 = rnorm(n, 50, 2);  x1 = exp(x2);  x3 = log(x2)
mean(x1); mean(x2); mean(x3)
[1] 3.686093e+22
[1] 50.01289         # aprx E(X2) = 50
[1] 3.911481
sd(x1); sd(x2); sd(x3)
[1] 2.308712e+23
[1] 1.997261         # aprx SD(X2) = 2
[1] 0.04004551
set.seed(720); n = 10^4
x2 = rnorm(n, 50, 2);  x1 = exp(x2);  x3 = log(x2)
mean(x1); mean(x2); mean(x3)
[1] 3.686093e+22
[1] 50.01289         # aprx E(X2) = 50
[1] 3.911481
sd(x1); sd(x2); sd(x3)
[1] 2.308712e+23
[1] 1.997261         # aprx SD(X2) = 2
[1] 0.04004551

enter image description here [![enter image description here][1]][1]

par(mfrow=c(1,3))
hist(x1, prob=T, br=50, col="skyblue2")
hist(x2, prob=T, col="skyblue2")
  curve(dnorm(x,50,2), add=T, col="red")
hist(x3, prob=T, col="skyblue2")
par(mfrow=c(1,1)) 
par(mfrow=c(1,3))
hist(x1, prob=TRUE, br=50, col="skyblue2")
hist(x2, prob=TRUE, col="skyblue2")
  curve(dnorm(x,50,2), add=TRUE, col="red")
hist(x3, prob=T, col="skyblue2")
par(mfrow=c(1,1)) 
set.seed(720); n = 10^5
x2 = runif(n);  x1 = exp(x2);  x3 = log(x2)
var(x1); var(x2); var(x3)
[1] 0.2411124
[1] 0.08316279  # aprx V(X2) = 1/12
[1] 1.01091

enter image description here

set.seed(720); n = 10^5
x2 = runif(n);  x1 = exp(x2);  x3 = log(x2)
var(x1); var(x2); var(x3)
[1] 0.2411124
[1] 0.08316279  # aprx V(X2) = 1/12
[1] 1.01091
```r

[![enter image description here][3]][3]

  [1]: https://i.sstatic.net/ICW5Y.png
  [2]: https://i.sstatic.net/h4Wm4.png
  [3]: https://i.sstatic.net/Trosu.png
set.seed(720); n = 10^4
x2 = rnorm(n, 50, 2);  x1 = exp(x2);  x3 = log(x2)
mean(x1); mean(x2); mean(x3)
[1] 3.686093e+22
[1] 50.01289         # aprx E(X2) = 50
[1] 3.911481
sd(x1); sd(x2); sd(x3)
[1] 2.308712e+23
[1] 1.997261         # aprx SD(X2) = 2
[1] 0.04004551

enter image description here

par(mfrow=c(1,3))
hist(x1, prob=T, br=50, col="skyblue2")
hist(x2, prob=T, col="skyblue2")
  curve(dnorm(x,50,2), add=T, col="red")
hist(x3, prob=T, col="skyblue2")
par(mfrow=c(1,1)) 
set.seed(720); n = 10^5
x2 = runif(n);  x1 = exp(x2);  x3 = log(x2)
var(x1); var(x2); var(x3)
[1] 0.2411124
[1] 0.08316279  # aprx V(X2) = 1/12
[1] 1.01091

enter image description here

set.seed(720); n = 10^4
x2 = rnorm(n, 50, 2);  x1 = exp(x2);  x3 = log(x2)
mean(x1); mean(x2); mean(x3)
[1] 3.686093e+22
[1] 50.01289         # aprx E(X2) = 50
[1] 3.911481
sd(x1); sd(x2); sd(x3)
[1] 2.308712e+23
[1] 1.997261         # aprx SD(X2) = 2
[1] 0.04004551

[![enter image description here][1]][1]

par(mfrow=c(1,3))
hist(x1, prob=TRUE, br=50, col="skyblue2")
hist(x2, prob=TRUE, col="skyblue2")
  curve(dnorm(x,50,2), add=TRUE, col="red")
hist(x3, prob=T, col="skyblue2")
par(mfrow=c(1,1)) 
set.seed(720); n = 10^5
x2 = runif(n);  x1 = exp(x2);  x3 = log(x2)
var(x1); var(x2); var(x3)
[1] 0.2411124
[1] 0.08316279  # aprx V(X2) = 1/12
[1] 1.01091
```r

[![enter image description here][3]][3]

  [1]: https://i.sstatic.net/ICW5Y.png
  [2]: https://i.sstatic.net/h4Wm4.png
  [3]: https://i.sstatic.net/Trosu.png
added 547 characters in body
Source Link
BruceET
  • 57.6k
  • 2
  • 36
  • 95

Comment on lognormal and normal distributions.

The variance of data tends to decrease when you take logs of the values. Perhaps the most common case is that, if $X_1$ is lognormal, then $X_2 = \ln(X_1)$ is normal, which has smaller variance than $X_.1$ Also, if it exists, $X_3 = \ln(X_2)$ may have a still smaller variance.

Below we begin with a random sample (using R) of $n = 10^4$ observations from a lognormal distribution with parameters $\mu = 50, \sigma = 2.$ (It is customary to use lognormal parameters that match parameters of the related normal distribution. You can look at Wikipedia on 'lognormal distributions' for details.) We show means and standard deviations for distributions of $X_1, X_2,$ and $X_3.$

set.seed(720); n = 10^4
x2 = rnorm(n, 50, 2);  x1 = exp(x2);  x3 = log(x2)
mean(x1); mean(x2); mean(x3)
[1] 3.686093e+22
[1] 50.01289         # aprx E(X2) = 50
[1] 3.911481
sd(x1); sd(x2); sd(x3)
[1] 2.308712e+23
[1] 1.997261         # aprx SD(X2) = 2
[1] 0.04004551

Then we show histograms of the three samples. At the left, notice that it is difficult to make an informative histogram of $X_1$ because it is so severely skewed to the right. In the center panel, we overlay the density function of $\mathsf{Norm}(\mu =50, \sigma=2);$ which is symmetrical. At the right, notice that taking (natural) logs once again results in a slightly left-skewed distribution.

enter image description here

Notes: (1) The the support of a lognormal distribution is $(0, \infty).$ A normal distribution may take negative values. If the lognormal distribution is truncated to $(1, \infty)$ so that the normal distribution is truncated to $(0,\infty),$ then the natural log of that "normal" distribution exists. The distribution $\mathsf{Norm}(50, 2)$ has almost no probability below $0,$ so the truncation would have little practical effect in this example.

(2) R code for the figure above:

par(mfrow=c(1,3))
hist(x1, prob=T, br=50, col="skyblue2")
hist(x2, prob=T, col="skyblue2")
  curve(dnorm(x,50,2), add=T, col="red")
hist(x3, prob=T, col="skyblue2")
par(mfrow=c(1,1)) 

(3) However, it is not always true that taking logs gives a smaller variance. If $X_2 \sim \mathsf{Unif}(0,1),\, X_1 = e^{X_2},$ and $X_3 = \ln(X_2),$ then R code similar to that abovethe code for the lognormal example gives the following results:

set.seed(720); n = 10^5
x2 = runif(n);  x1 = exp(x2);  x3 = log(x2)
var(x1); var(x2); var(x3)
[1] 0.2411124
[1] 0.08316279  # aprx V(X2) = 1/12
[1] 1.01091

enter image description here

Comment on lognormal and normal distributions.

The variance of data tends to decrease when you take logs of the values. Perhaps the most common case is that, if $X_1$ is lognormal, then $X_2 = \ln(X_1)$ is normal, which has smaller variance than $X_.1$ Also, if it exists, $X_3 = \ln(X_2)$ may have a still smaller variance.

Below we begin with a random sample (using R) of $n = 10^4$ observations from a lognormal distribution with parameters $\mu = 50, \sigma = 2.$ (It is customary to use lognormal parameters that match parameters of the related normal distribution. You can look at Wikipedia on 'lognormal distributions' for details.) We show means and standard deviations for distributions of $X_1, X_2,$ and $X_3.$

set.seed(720); n = 10^4
x2 = rnorm(n, 50, 2);  x1 = exp(x2);  x3 = log(x2)
mean(x1); mean(x2); mean(x3)
[1] 3.686093e+22
[1] 50.01289         # aprx E(X2) = 50
[1] 3.911481
sd(x1); sd(x2); sd(x3)
[1] 2.308712e+23
[1] 1.997261         # aprx SD(X2) = 2
[1] 0.04004551

Then we show histograms of the three samples. At the left, notice that it is difficult to make an informative histogram of $X_1$ because it is so severely skewed to the right. In the center panel, we overlay the density function of $\mathsf{Norm}(\mu =50, \sigma=2);$ which is symmetrical. At the right, notice that taking (natural) logs once again results in a slightly left-skewed distribution.

enter image description here

Notes: (1) The the support of a lognormal distribution is $(0, \infty).$ A normal distribution may take negative values. If the lognormal distribution is truncated to $(1, \infty)$ so that the normal distribution is truncated to $(0,\infty),$ then the natural log of that "normal" distribution exists. The distribution $\mathsf{Norm}(50, 2)$ has almost no probability below $0,$ so the truncation would have little practical effect in this example.

(2) R code for the figure above:

par(mfrow=c(1,3))
hist(x1, prob=T, br=50, col="skyblue2")
hist(x2, prob=T, col="skyblue2")
  curve(dnorm(x,50,2), add=T, col="red")
hist(x3, prob=T, col="skyblue2")
par(mfrow=c(1,1)) 

(3) However, it is not always true that taking logs gives a smaller variance. If $X_2 \sim \mathsf{Unif}(0,1),\, X_1 = e^{X_2},$ and $X_3 = \ln(X_2),$ then R code similar to that above gives the following results:

set.seed(720); n = 10^5
x2 = runif(n);  x1 = exp(x2);  x3 = log(x2)
var(x1); var(x2); var(x3)
[1] 0.2411124
[1] 0.08316279  # aprx V(X2) = 1/12
[1] 1.01091

enter image description here

Comment on lognormal and normal distributions.

The variance of data tends to decrease when you take logs of the values. Perhaps the most common case is that, if $X_1$ is lognormal, then $X_2 = \ln(X_1)$ is normal, which has smaller variance than $X_.1$ Also, if it exists, $X_3 = \ln(X_2)$ may have a still smaller variance.

Below we begin with a random sample (using R) of $n = 10^4$ observations from a lognormal distribution with parameters $\mu = 50, \sigma = 2.$ (It is customary to use lognormal parameters that match parameters of the related normal distribution. You can look at Wikipedia on 'lognormal distributions' for details.) We show means and standard deviations for distributions of $X_1, X_2,$ and $X_3.$

set.seed(720); n = 10^4
x2 = rnorm(n, 50, 2);  x1 = exp(x2);  x3 = log(x2)
mean(x1); mean(x2); mean(x3)
[1] 3.686093e+22
[1] 50.01289         # aprx E(X2) = 50
[1] 3.911481
sd(x1); sd(x2); sd(x3)
[1] 2.308712e+23
[1] 1.997261         # aprx SD(X2) = 2
[1] 0.04004551

Then we show histograms of the three samples. At the left, notice that it is difficult to make an informative histogram of $X_1$ because it is so severely skewed to the right. In the center panel, we overlay the density function of $\mathsf{Norm}(\mu =50, \sigma=2);$ which is symmetrical. At the right, notice that taking (natural) logs once again results in a slightly left-skewed distribution.

enter image description here

Notes: (1) The the support of a lognormal distribution is $(0, \infty).$ A normal distribution may take negative values. If the lognormal distribution is truncated to $(1, \infty)$ so that the normal distribution is truncated to $(0,\infty),$ then the natural log of that "normal" distribution exists. The distribution $\mathsf{Norm}(50, 2)$ has almost no probability below $0,$ so the truncation would have little practical effect in this example.

(2) R code for the figure above:

par(mfrow=c(1,3))
hist(x1, prob=T, br=50, col="skyblue2")
hist(x2, prob=T, col="skyblue2")
  curve(dnorm(x,50,2), add=T, col="red")
hist(x3, prob=T, col="skyblue2")
par(mfrow=c(1,1)) 

(3) However, it is not always true that taking logs gives a smaller variance. If $X_2 \sim \mathsf{Unif}(0,1),\, X_1 = e^{X_2},$ and $X_3 = \ln(X_2),$ then R code similar to the code for the lognormal example gives the following results:

set.seed(720); n = 10^5
x2 = runif(n);  x1 = exp(x2);  x3 = log(x2)
var(x1); var(x2); var(x3)
[1] 0.2411124
[1] 0.08316279  # aprx V(X2) = 1/12
[1] 1.01091

enter image description here

added 547 characters in body
Source Link
BruceET
  • 57.6k
  • 2
  • 36
  • 95

Comment on lognormal and normal distributions.

The variance of data tends to decrease when you take logs of the values. Perhaps the most common case is that, if $X_1$ is lognormal, then $X_2 = \ln(X_1)$ is normal, which has smaller variance than $X_.1$ Also, if it exists, $X_3 = \ln(X_2)$ hasmay have a still smaller variance.

Below we begin with a random sample (using R) of $n = 10^4$ observations from a lognormal distribution with parameters $\mu = 50, \sigma = 2.$ (It is customary to use lognormal parameters that match parameters of the related normal distribution. You can look at Wikipedia on 'lognormal distributions' for details.) We show means and standard deviations for distributions of $X_1, X_2,$ and $X_3.$

set.seed(720); n = 10^4
x2 = rnorm(n, 50, 2);  x1 = exp(x2);  x3 = log(x2)
mean(x1); mean(x2); mean(x3)
[1] 3.686093e+22
[1] 50.01289         # aprx E(X2) = 50
[1] 3.911481
sd(x1); sd(x2); sd(x3)
[1] 2.308712e+23
[1] 1.997261         # aprx SD(X2) = 2
[1] 0.04004551

Then we show histograms of the three samples. At the left, notice that it is difficult to make an informative histogram of $X_1$ because it is so severely skewed to the right. In the center panel, we overlay the density function of $\mathsf{Norm}(\mu =50, \sigma=2);$ which is symmetrical. At the right, notice that taking (natural) logs once again results in a slightly left-skewed distribution.

enter image description here

Notes: (1) The the support of a lognormal distribution is $(0, \infty).$ A normal distribution may take negative values. If the lognormal distribution is truncated to $(1, \infty)$ so that the normal distribution is truncated to $(0,\infty),$ then the natural log of that "normal" distribution exists. The distribution $\mathsf{Norm}(50, 2)$ has almost no probability below $0,$ so the truncation would have little practical effect in this example.

(2) R code for the figure above:

par(mfrow=c(1,3))
hist(x1, prob=T, br=50, col="skyblue2")
hist(x2, prob=T, col="skyblue2")
  curve(dnorm(x,50,2), add=T, col="red")
hist(x3, prob=T, col="skyblue2")
par(mfrow=c(1,1)) 

(3) However, it is not always true that taking logs gives a smaller variance. If $X_2 \sim \mathsf{Unif}(0,1),\, X_1 = e^{X_2},$ and $X_3 = \ln(X_2),$ then R code similar to that above gives the following results:

set.seed(720); n = 10^5
x2 = runif(n);  x1 = exp(x2);  x3 = log(x2)
var(x1); var(x2); var(x3)
[1] 0.2411124
[1] 0.08316279  # aprx V(X2) = 1/12
[1] 1.01091

enter image description here

Comment on lognormal and normal distributions.

The variance of data tends to decrease when you take logs of the values. Perhaps the most common case is that, if $X_1$ is lognormal, then $X_2 = \ln(X_1)$ is normal, which has smaller variance than $X_.1$ Also, if it exists, $X_3 = \ln(X_2)$ has a still smaller variance.

Below we begin with a random sample (using R) of $n = 10^4$ observations from a lognormal distribution with parameters $\mu = 50, \sigma = 2.$ (It is customary to use lognormal parameters that match parameters of the related normal distribution. You can look at Wikipedia on 'lognormal distributions' for details.) We show means and standard deviations for distributions of $X_1, X_2,$ and $X_3.$

set.seed(720); n = 10^4
x2 = rnorm(n, 50, 2);  x1 = exp(x2);  x3 = log(x2)
mean(x1); mean(x2); mean(x3)
[1] 3.686093e+22
[1] 50.01289         # aprx E(X2) = 50
[1] 3.911481
sd(x1); sd(x2); sd(x3)
[1] 2.308712e+23
[1] 1.997261         # aprx SD(X2) = 2
[1] 0.04004551

Then we show histograms of the three samples. At the left, notice that it is difficult to make an informative histogram of $X_1$ because it is so severely skewed to the right. In the center panel, we overlay the density function of $\mathsf{Norm}(\mu =50, \sigma=2);$ which is symmetrical. At the right, notice that taking (natural) logs once again results in a slightly left-skewed distribution.

enter image description here

Notes: (1) The the support of a lognormal distribution is $(0, \infty).$ A normal distribution may take negative values. If the lognormal distribution is truncated to $(1, \infty)$ so that the normal distribution is truncated to $(0,\infty),$ then the natural log of that "normal" distribution exists. The distribution $\mathsf{Norm}(50, 2)$ has almost no probability below $0,$ so the truncation would have little practical effect in this example.

(2) R code for the figure:

par(mfrow=c(1,3))
hist(x1, prob=T, br=50, col="skyblue2")
hist(x2, prob=T, col="skyblue2")
  curve(dnorm(x,50,2), add=T, col="red")
hist(x3, prob=T, col="skyblue2")
par(mfrow=c(1,1)) 

Comment on lognormal and normal distributions.

The variance of data tends to decrease when you take logs of the values. Perhaps the most common case is that, if $X_1$ is lognormal, then $X_2 = \ln(X_1)$ is normal, which has smaller variance than $X_.1$ Also, if it exists, $X_3 = \ln(X_2)$ may have a still smaller variance.

Below we begin with a random sample (using R) of $n = 10^4$ observations from a lognormal distribution with parameters $\mu = 50, \sigma = 2.$ (It is customary to use lognormal parameters that match parameters of the related normal distribution. You can look at Wikipedia on 'lognormal distributions' for details.) We show means and standard deviations for distributions of $X_1, X_2,$ and $X_3.$

set.seed(720); n = 10^4
x2 = rnorm(n, 50, 2);  x1 = exp(x2);  x3 = log(x2)
mean(x1); mean(x2); mean(x3)
[1] 3.686093e+22
[1] 50.01289         # aprx E(X2) = 50
[1] 3.911481
sd(x1); sd(x2); sd(x3)
[1] 2.308712e+23
[1] 1.997261         # aprx SD(X2) = 2
[1] 0.04004551

Then we show histograms of the three samples. At the left, notice that it is difficult to make an informative histogram of $X_1$ because it is so severely skewed to the right. In the center panel, we overlay the density function of $\mathsf{Norm}(\mu =50, \sigma=2);$ which is symmetrical. At the right, notice that taking (natural) logs once again results in a slightly left-skewed distribution.

enter image description here

Notes: (1) The the support of a lognormal distribution is $(0, \infty).$ A normal distribution may take negative values. If the lognormal distribution is truncated to $(1, \infty)$ so that the normal distribution is truncated to $(0,\infty),$ then the natural log of that "normal" distribution exists. The distribution $\mathsf{Norm}(50, 2)$ has almost no probability below $0,$ so the truncation would have little practical effect in this example.

(2) R code for the figure above:

par(mfrow=c(1,3))
hist(x1, prob=T, br=50, col="skyblue2")
hist(x2, prob=T, col="skyblue2")
  curve(dnorm(x,50,2), add=T, col="red")
hist(x3, prob=T, col="skyblue2")
par(mfrow=c(1,1)) 

(3) However, it is not always true that taking logs gives a smaller variance. If $X_2 \sim \mathsf{Unif}(0,1),\, X_1 = e^{X_2},$ and $X_3 = \ln(X_2),$ then R code similar to that above gives the following results:

set.seed(720); n = 10^5
x2 = runif(n);  x1 = exp(x2);  x3 = log(x2)
var(x1); var(x2); var(x3)
[1] 0.2411124
[1] 0.08316279  # aprx V(X2) = 1/12
[1] 1.01091

enter image description here

added 341 characters in body
Source Link
BruceET
  • 57.6k
  • 2
  • 36
  • 95
Loading
added 341 characters in body
Source Link
BruceET
  • 57.6k
  • 2
  • 36
  • 95
Loading
Source Link
BruceET
  • 57.6k
  • 2
  • 36
  • 95
Loading