1 min read

分布变离散,或者纠正skew

分布变离散,或者纠正skew

我之前在书上看的,为了满足正态分布假设做的调整。

这个可以将一个分布变离散,或者纠正skew。

\[y' = \exp(n\cdot y)\]

set.seed(123)
x <- rnorm(100, mean = 1, sd = 1)
library(tidyverse)
## Warning: 程辑包'tidyverse'是用R版本3.6.3 来建造的
## -- Attaching packages --------------------------------------------------------------------------- tidyverse 1.3.0 --
## √ ggplot2 3.3.2     √ purrr   0.3.4
## √ tibble  3.0.3     √ dplyr   1.0.2
## √ tidyr   1.1.2     √ stringr 1.4.0
## √ readr   1.3.1     √ forcats 0.5.0
## Warning: 程辑包'ggplot2'是用R版本3.6.3 来建造的
## Warning: 程辑包'tibble'是用R版本3.6.3 来建造的
## Warning: 程辑包'tidyr'是用R版本3.6.3 来建造的
## Warning: 程辑包'readr'是用R版本3.6.3 来建造的
## Warning: 程辑包'purrr'是用R版本3.6.3 来建造的
## Warning: 程辑包'dplyr'是用R版本3.6.3 来建造的
## Warning: 程辑包'stringr'是用R版本3.6.3 来建造的
## Warning: 程辑包'forcats'是用R版本3.6.3 来建造的
## -- Conflicts ------------------------------------------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
x %>% 
  as_tibble() %>% 
ggplot(aes(x = value, fill = "red"),alpha = .25) +
  geom_density() +
  # geom_density(aes(x = log(x),fill = "blue"),alpha = .25) +
  geom_density(aes(x = exp(1.5*x),fill = "green"),alpha = .25)