Last updated: 2020-08-05

Checks: 7 0

Knit directory: 2019-feature-selection/

This reproducible R Markdown analysis was created with workflowr (version 1.6.1). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20190522) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 9fe93ea. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    .Ruserdata/
    Ignored:    .drake/
    Ignored:    .vscode/
    Ignored:    analysis/rosm.cache/
    Ignored:    data/
    Ignored:    inst/Benchmark for Filter Methods for Feature Selection in High-Dimensional  Classification Data.pdf
    Ignored:    inst/study-area-map/._study-area.qgs
    Ignored:    inst/study-area-map/study-area.qgs~
    Ignored:    log/
    Ignored:    renv/library/
    Ignored:    renv/staging/
    Ignored:    reviews/
    Ignored:    rosm.cache/

Unstaged changes:
    Modified:   analysis/report-defoliation.Rmd

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/response-normality.Rmd) and HTML (docs/response-normality.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
html 7c7c7d9 pat-s 2020-02-25 Build site.
Rmd 6d8c0be pat-s 2020-02-25 wflow_publish(knitr_in(“analysis/response-normality.Rmd”), view =
Rmd bbd422a pat-s 2020-02-24 update reports
html 8d84438 pat-s 2020-01-08 Build site.
html 4edabc0 pat-s 2019-12-21 Build site.
html 3e8e33d pat-s 2019-11-06 Build site.
html 9241b85 pat-s 2019-10-05 Build site.
html fdc8064 pat-s 2019-09-28 Build site.
html 0b18307 pat-s 2019-09-21 Build site.
html aa0486b pat-s 2019-09-15 Build site.
Rmd bfd9ac1 pat-s 2019-09-15 wflow_publish(knitr_in(“analysis/response-normality.Rmd”), view =
Rmd 4b59fe9 pat-s 2019-09-12 wflow_publish(knitr_in(“analysis/response-normality.Rmd”), view =
Rmd 518d0cb pat-s 2019-09-01 style files using tidyverse style
Rmd 7582c67 pat-s 2019-08-31 Build site.
Rmd a5308c2 pat-s 2019-08-31 add response-normality Rmd

Last update:

[1] "Wed Aug  5 18:21:10 2020"

This document originated from the fear of having a response variable which is not normally distributed “enough”.

The response variable looks as follows:

Version Author Date
7c7c7d9 pat-s 2020-02-25
4edabc0 pat-s 2019-12-21
9241b85 pat-s 2019-10-05
fdc8064 pat-s 2019-09-28
aa0486b pat-s 2019-09-15

When applying the Shapiro-Wilk test we get


    Shapiro-Wilk normality test

data:  vi_data_corrected_buffer2$defoliation
W = 0.86069, p-value < 2.2e-16

Exploring model residuals

Visualizing model residuals of LASSO and RF to see how they differ. The LASSO “predicted vs. fitted” plot shows limited model power.

Lasso model with no transformation of the response variable

Version Author Date
7c7c7d9 pat-s 2020-02-25
8d84438 pat-s 2020-01-08
4edabc0 pat-s 2019-12-21
3e8e33d pat-s 2019-11-06
9241b85 pat-s 2019-10-05
fdc8064 pat-s 2019-09-28
0b18307 pat-s 2019-09-21
aa0486b pat-s 2019-09-15

SVM with no transformation of the response variable

Version Author Date
7c7c7d9 pat-s 2020-02-25
8d84438 pat-s 2020-01-08
4edabc0 pat-s 2019-12-21
3e8e33d pat-s 2019-11-06
9241b85 pat-s 2019-10-05
fdc8064 pat-s 2019-09-28
0b18307 pat-s 2019-09-21
aa0486b pat-s 2019-09-15

Variable Transformations

The following transformations of the response variable were done to check if it they have an effect on the “residuals vs. fitted” and “QQ-Plot” shown above.

Power transformation

One option to enforce more normality of a variable is by applying a power transformation. The Box-Cox power transformation estimates a lambda value from the variable. Next, the transformation can be applied via

\[(y^lambda - 1) / lambda\]

There is a Stackoverflow question that shows how to do this.

Box-Cox Transformation

Applying it on the response of the data.

Version Author Date
7c7c7d9 pat-s 2020-02-25
[1] 0.7878788

    Shapiro-Wilk normality test

data:  y_new1
W = 0.84181, p-value < 2.2e-16

The “W” value is a little less than before.

There is another way to do this via package car.


    Shapiro-Wilk normality test

data:  y_new2
W = 0.8433, p-value < 2.2e-16

Exploring the residuals of a Lasso model with no transformation of the response variable.

Version Author Date
7c7c7d9 pat-s 2020-02-25

R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS:   /opt/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/r-3.6.1-j25wr6zcofibs2zfjwg37357rjj26lqb/rlib/R/lib/libRblas.so
LAPACK: /opt/spack/opt/spack/linux-centos7-x86_64/gcc-9.2.0/r-3.6.1-j25wr6zcofibs2zfjwg37357rjj26lqb/rlib/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] tidyselect_0.2.5 MASS_7.3-51.4    ggplot2_3.3.0    drake_7.12.0    

loaded via a namespace (and not attached):
 [1] fs_1.4.1           filelock_1.0.2     RColorBrewer_1.1-2
 [4] progress_1.2.0     httr_1.4.0         rprojroot_1.3-2   
 [7] tools_3.6.1        backports_1.1.5    R6_2.4.1          
[10] lazyeval_0.2.1     colorspace_1.4-0   withr_2.1.2       
[13] prettyunits_1.0.2  mco_1.0-15.1       curl_3.3          
[16] compiler_3.6.1     git2r_0.26.1       parallelMap_1.4   
[19] glmnet_3.0-2       cli_2.0.2          DiceKriging_1.5.6 
[22] plotly_4.8.0       labeling_0.3       scales_1.1.0      
[25] checkmate_2.0.0    plot3D_1.1.1       stringr_1.4.0     
[28] digest_0.6.25      foreign_0.8-72     txtq_0.1.4        
[31] rmarkdown_1.13     rio_0.5.16         smoof_1.5.1       
[34] pkgconfig_2.0.3    htmltools_0.3.6    lhs_1.0.1         
[37] readxl_1.3.0       htmlwidgets_1.3    rlang_0.4.5       
[40] BBmisc_1.11        shape_1.4.4        farver_2.0.3      
[43] mlrMBO_1.1.2       jsonlite_1.6       zip_2.0.4         
[46] dplyr_0.8.3        car_3.0-3          magrittr_1.5      
[49] Matrix_1.2-15      Rcpp_1.0.3         munsell_0.5.0     
[52] fansi_0.4.1        abind_1.4-5        lifecycle_0.1.0   
[55] stringi_1.3.1      whisker_0.3-2      yaml_2.2.0        
[58] carData_3.0-2      storr_1.2.1        RJSONIO_1.3-1.1   
[61] grid_3.6.1         misc3d_0.8-4       parallel_3.6.1    
[64] promises_1.0.1     forcats_0.4.0      crayon_1.3.4      
[67] lattice_0.20-38    haven_2.1.0        splines_3.6.1     
[70] hms_0.5.3          knitr_1.23         mlr_2.17.0.9001   
[73] pillar_1.4.3       igraph_1.2.4.1     base64url_1.4     
[76] codetools_0.2-16   fastmatch_1.1-0    glue_1.4.0        
[79] evaluate_0.13      ParamHelpers_1.12  data.table_1.12.8 
[82] vctrs_0.2.4        httpuv_1.4.5.1     foreach_1.4.4     
[85] cellranger_1.1.0   gtable_0.3.0       purrr_0.3.4       
[88] tidyr_1.0.0        kernlab_0.9-27     assertthat_0.2.1  
[91] openxlsx_4.1.0     xfun_0.5           later_1.0.0       
[94] survival_2.43-3    viridisLite_0.3.0  tibble_2.1.3      
[97] iterators_1.0.10   workflowr_1.6.1