06: Correlação canônica entre caracteres morfológicos e componentes de rendimento em genótipos de linho (Linum usitatissimum, L.)
1 Libraries
2 Dados
df <-
import("data/data_mgidi.csv") |>
remove_rows_na() |>
filter(epoca %in% c("E1", "E4")) |>
replace_string(epoca, pattern = "E4", replacement = "E2")
3 Canônica
3.1 Modelo
can <-
df |>
can_corr(FG = c(ap, ac, nc, nr),
SG = c(ngcap, areac, rgpla, mmg, icc))
## ---------------------------------------------------------------------------
## Matrix (correlation/covariance) between variables of first group (FG)
## ---------------------------------------------------------------------------
## ap ac nc nr
## ap 1.0000000 0.5287163 0.3155772 0.2856869
## ac 0.5287163 1.0000000 -0.2029215 -0.2280093
## nc 0.3155772 -0.2029215 1.0000000 0.5662655
## nr 0.2856869 -0.2280093 0.5662655 1.0000000
## ---------------------------------------------------------------------------
## Collinearity within first group
## ---------------------------------------------------------------------------
## Weak multicollinearity in the matrix
## cn = 6.759
## Matrix determinant: 0.3109707
## Largest correlation: nc x nr = 0.566
## Smallest correlation: ac x nc = -0.203
## Number of VIFs > 10: 0
## Number of correlations with r >= |0.8|:
## Variables with largest weight in the last eigenvalues:
## ap > ac > nc > nr
## ---------------------------------------------------------------------------
## Matrix (correlation/covariance) between variables of second group (SG)
## ---------------------------------------------------------------------------
## ngcap areac rgpla mmg icc
## ngcap 1.00000000 0.62671978 0.37287028 -0.05537582 0.19075247
## areac 0.62671978 1.00000000 0.59475706 0.48901557 0.02779455
## rgpla 0.37287028 0.59475706 1.00000000 0.43319699 0.03159118
## mmg -0.05537582 0.48901557 0.43319699 1.00000000 0.08147575
## icc 0.19075247 0.02779455 0.03159118 0.08147575 1.00000000
## ---------------------------------------------------------------------------
## Collinearity within second group
## ---------------------------------------------------------------------------
## Weak multicollinearity in the matrix
## cn = 14.52
## Matrix determinant: 0.1803844
## Largest correlation: ngcap x areac = 0.627
## Smallest correlation: areac x icc = 0.028
## Number of VIFs > 10: 0
## Number of correlations with r >= |0.8|:
## Variables with largest weight in the last eigenvalues:
## areac > ngcap > mmg > icc > rgpla
## ---------------------------------------------------------------------------
## Matrix (correlation/covariance) between FG and SG
## ---------------------------------------------------------------------------
## ngcap areac rgpla mmg icc
## ap 0.2833453 0.4954944 0.3356632 0.2608546 0.106584280
## ac -0.1709379 -0.1769648 -0.2394161 -0.1742945 -0.012390649
## nc 0.2570310 0.4504205 0.9486292 0.3286273 -0.009320794
## nr 0.2775278 0.3875968 0.4942266 0.1959420 0.053042784
## ---------------------------------------------------------------------------
## Correlation of the canonical pairs and hypothesis testing
## ---------------------------------------------------------------------------
## Var Percent Sum Corr Lambda Chisq DF p_val
## U1V1 0.937212054 65.9606722 65.96067 0.96809713 0.03345 390.74129 20 0.00000
## U2V2 0.447290136 31.4801307 97.44080 0.66879753 0.53272 72.42220 12 0.00000
## U3V3 0.029747620 2.0936276 99.53443 0.17247499 0.96383 4.23616 6 0.64475
## U4V4 0.006615113 0.4655695 100.00000 0.08133335 0.99338 0.76327 2 0.68275
## ---------------------------------------------------------------------------
## Canonical coefficients of the first group
## ---------------------------------------------------------------------------
## U1 U2 U3 U4
## ap 0.007907902 1.33441344 0.05118299 -0.5197664
## ac 0.031486429 -0.99439129 0.96364345 0.1086589
## nc -1.061135315 -0.60958951 -0.01718989 -0.4095889
## nr 0.124753416 0.03811712 0.45212104 1.1937151
## ---------------------------------------------------------------------------
## Canonical coefficients of the second group
## ---------------------------------------------------------------------------
## V1 V2 V3 V4
## ngcap 0.10267926 0.2220980 -1.3096444 0.905088630
## areac 0.11327274 0.9171247 1.5176098 -0.373820392
## rgpla -1.13075412 -0.5690758 0.1023200 0.110316961
## mmg 0.09981241 0.2877891 -1.3081765 -0.494047830
## icc 0.02237442 0.1692762 0.4133638 0.002260751
## ---------------------------------------------------------------------------
## Canonical loads of the first group
## ---------------------------------------------------------------------------
## U1 U2 U3 U4
## ap -0.2746744 0.62717952 0.6844173 -0.25054486
## ac 0.2225497 -0.17385736 0.8911051 -0.35521395
## nc -0.9943855 0.03488872 0.0594389 0.08029517
## nr -0.4810509 0.30088253 0.2372896 0.78851339
## ---------------------------------------------------------------------------
## Canonical loads of the second group
## ---------------------------------------------------------------------------
## V1 V2 V3 V4
## ngcap -0.24921430 0.6010400 -0.16908476 0.73973146
## areac -0.44546844 0.8632944 0.12945585 0.01749410
## rgpla -0.98115305 0.1892214 -0.03703782 0.01151668
## mmg -0.33849772 0.4912485 -0.41551521 -0.67899867
## icc 0.01751954 0.2426031 0.10237494 0.12775059
3.2 Correlação canônica
canc <- gmd(can, "canonical") |> round_cols(digits = 5)
# export(canc, "data/results_canonica.xlsx", which = "canonica")
datatable(canc)
3.3 Cargas canônicas
loads <- gmd(can, "loads") |> round_cols(digits = 5)
# export(loads, "data/results_canonica.xlsx", which = "loads")
datatable(loads)
4 Diagrama
4.1 Primeiro par
flowchart LR subgraph Z["Caracteres de planta"] direction LR A[AP] --> |-0.274|B[planta] C[AC] --> |0.222|B D[NC] --> |-0.994|B E[NR] --> |-0.481|B end subgraph ZA["Componentes do rendimento"] direction RL F[NGC] --> |-0.249|G[rendimento] H[AC] --> |-0.445|G I[RGP] --> |-0.481|G J[MMG] --> |-0.338|G K[ICP] --> |0.0175|G end Z <--> |0.968| ZA
4.2 segundo par
flowchart LR subgraph Z["Caracteres de planta"] direction LR A([AP]) --> |0.627|B{planta} C([AC]) --> |-0.174|B D([NC]) --> |0.034|B E([NR]) --> |0.301|B end subgraph ZA["Componentes do rendimento"] direction RL F([NGC]) --> | 0.601|G{rendimento} H([AC]) --> |0.863|G I([RGP]) --> |0.189|G J([MMG]) --> |0.491|G K([ICP]) --> |0.243|G end Z <--> |0.669| ZA
5 Section info
sessionInfo()
## R version 4.2.2 (2022-10-31 ucrt)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 10 x64 (build 22621)
##
## Matrix products: default
##
## locale:
## [1] LC_COLLATE=Portuguese_Brazil.utf8 LC_CTYPE=Portuguese_Brazil.utf8
## [3] LC_MONETARY=Portuguese_Brazil.utf8 LC_NUMERIC=C
## [5] LC_TIME=Portuguese_Brazil.utf8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] DT_0.28 metan_1.18.0 lubridate_1.9.2 forcats_1.0.0
## [5] stringr_1.5.0 dplyr_1.1.2 purrr_1.0.1 readr_2.1.4
## [9] tidyr_1.3.0 tibble_3.2.1 ggplot2_3.4.2 tidyverse_2.0.0
## [13] rio_0.5.29
##
## loaded via a namespace (and not attached):
## [1] sass_0.4.6 jsonlite_1.8.7 splines_4.2.2
## [4] bslib_0.5.0 cellranger_1.1.0 yaml_2.3.7
## [7] ggrepel_0.9.3 numDeriv_2016.8-1.1 pillar_1.9.0
## [10] lattice_0.20-45 glue_1.6.2 digest_0.6.33
## [13] RColorBrewer_1.1-3 polyclip_1.10-4 minqa_1.2.5
## [16] colorspace_2.1-0 htmltools_0.5.5 Matrix_1.6-0
## [19] plyr_1.8.8 pkgconfig_2.0.3 haven_2.5.3
## [22] patchwork_1.1.2 scales_1.2.1 tweenr_2.0.2
## [25] openxlsx_4.2.5.2 tzdb_0.4.0 lme4_1.1-34
## [28] ggforce_0.4.1 timechange_0.2.0 generics_0.1.3
## [31] farver_2.1.1 ellipsis_0.3.2 cachem_1.0.8
## [34] withr_2.5.0 cli_3.6.1 magrittr_2.0.3
## [37] readxl_1.4.3 evaluate_0.21 GGally_2.1.2
## [40] fansi_1.0.4 nlme_3.1-160 MASS_7.3-60
## [43] foreign_0.8-83 tools_4.2.2 data.table_1.14.8
## [46] hms_1.1.3 lifecycle_1.0.3 munsell_0.5.0
## [49] zip_2.3.0 jquerylib_0.1.4 compiler_4.2.2
## [52] rlang_1.1.1 grid_4.2.2 nloptr_2.0.3
## [55] rstudioapi_0.15.0 htmlwidgets_1.6.2 crosstalk_1.2.0
## [58] rmarkdown_2.23 boot_1.3-28 gtable_0.3.3
## [61] lmerTest_3.1-3 reshape_0.8.9 curl_5.0.1
## [64] R6_2.5.1 knitr_1.43 fastmap_1.1.1
## [67] utf8_1.2.3 mathjaxr_1.6-0 stringi_1.7.12
## [70] Rcpp_1.0.11 vctrs_0.6.3 tidyselect_1.2.0
## [73] xfun_0.39