Box Cox Transformation

Simulate Data

Min. 1st Qu. Median Mean 3rd Qu. Max. 0.1582 0.9273 1.4160 1.5461 1.9724 5.0082

Transformation

\[Y = \frac{X^{\lambda} - 1}{\lambda}\]

  • The boxcox function gives lambda values and their corresponding log-Likelihood which follow a chi-squared distribution.

Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 

-1.41613 -0.07468 0.36660 0.34208 0.75340 2.07151

[1] 0.6363773

Shapiro-Wilk Test

Shapiro-Wilk normality test

data: x W = 0.93318, p-value = 3.234e-09

Shapiro-Wilk normality test

data: y W = 0.9976, p-value = 0.9735

R sessionInfo

R version 4.2.0 (2022-04-22) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.3 LTS

Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0 LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale: [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
[4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
[7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] MASS_7.3-54 Wu_0.0.0.9000 flexdashboard_0.6.0 [4] lme4_1.1-30 Matrix_1.4-0 mgcv_1.8-38
[7] nlme_3.1-152 png_0.1-7 scales_1.2.0
[10] nnet_7.3-16 labelled_2.9.1 kableExtra_1.3.4
[13] plotly_4.10.0 gridExtra_2.3 ggplot2_3.3.6
[16] DT_0.24 tableone_0.13.2 magrittr_2.0.3
[19] lubridate_1.8.0 dplyr_1.0.9 plyr_1.8.7
[22] data.table_1.14.2 rmdformats_1.0.4 knitr_1.39

loaded via a namespace (and not attached): [1] httr_1.4.4 sass_0.4.2 tidyr_1.2.0 jsonlite_1.8.0
[5] viridisLite_0.4.0 splines_4.2.0 carData_3.0-5 bslib_0.4.0
[9] assertthat_0.2.1 highr_0.9 yaml_2.3.5 pillar_1.8.1
[13] lattice_0.20-45 glue_1.6.2 digest_0.6.29 RColorBrewer_1.1-3 [17] rvest_1.0.2 minqa_1.2.4 colorspace_2.0-3 htmltools_0.5.3
[21] survey_4.1-1 pkgconfig_2.0.3 haven_2.5.0 bookdown_0.28
[25] purrr_0.3.4 webshot_0.5.3 svglite_2.1.0 tibble_3.1.8
[29] car_3.1-0 farver_2.1.1 generics_0.1.3 ellipsis_0.3.2
[33] cachem_1.0.6 withr_2.5.0 klippy_0.0.0.9500 lazyeval_0.2.2
[37] cli_3.3.0 survival_3.2-13 evaluate_0.16 fansi_1.0.3
[41] forcats_0.5.1 xml2_1.3.3 tools_4.2.0 hms_1.1.1
[45] mitools_2.4 lifecycle_1.0.1 stringr_1.4.0 munsell_0.5.0
[49] compiler_4.2.0 jquerylib_0.1.4 systemfonts_1.0.4 rlang_1.0.4
[53] grid_4.2.0 nloptr_2.0.3 rstudioapi_0.13 htmlwidgets_1.5.4 [57] crosstalk_1.2.0 rmarkdown_2.14 boot_1.3-28 gtable_0.3.0
[61] abind_1.4-5 DBI_1.1.3 R6_2.5.1 fastmap_1.1.0
[65] utf8_1.2.2 stringi_1.7.8 Rcpp_1.0.9 vctrs_0.4.1
[69] tidyselect_1.1.2 xfun_0.32