For selecting the right amount of penalization, however, k-fold cross validation should be performed over a fine grid of (many) sensible values \(\lambda\). Due to time-consuming computation and undesireably high dimensions of outputs, we recommend to set the default CVfit = FALSE
. By doing so, the function only stores VAF values for both the training set and the validation set.
In addiction, the function provides the option of both non-monotone effects and incorporating constraints enforcing monotonicity, specified by the logical argument constr
. For the ehd
data the assumption of monotonic effects seems reasonable.
lambda <- 10^seq(4, -4, by = -0.1)
set.seed(456)
ehd_pca4 <- ordPCA(H, p = 5, lambda = lambda, maxit = 100, crit = 1e-7,
qstart = NULL, Ks = apply(H, 2, max), constr = rep(TRUE, ncol(H)),
CV = TRUE, k = 5, CVfit = FALSE)
ehd_pca4$VAFtest
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7]
#> [1,] 0.6799670 0.6799684 0.6799703 0.6799726 0.6799755 0.6799792 0.6799838
#> [2,] 0.7235242 0.7235258 0.7235279 0.7235304 0.7235336 0.7235376 0.7235427
#> [3,] 0.7036975 0.7036989 0.7037008 0.7037031 0.7037059 0.7037096 0.7037142
#> [4,] 0.7520625 0.7520639 0.7520657 0.7520678 0.7520706 0.7520740 0.7520784
#> [5,] 0.7063461 0.7063472 0.7063487 0.7063505 0.7063527 0.7063555 0.7063591
#> [,8] [,9] [,10] [,11] [,12] [,13] [,14]
#> [1,] 0.6799896 0.6799969 0.6800061 0.6800176 0.6800321 0.6800502 0.6800730
#> [2,] 0.7235490 0.7235571 0.7235671 0.7235798 0.7235956 0.7236156 0.7236405
#> [3,] 0.7037199 0.7037271 0.7037362 0.7037476 0.7037620 0.7037800 0.7038025
#> [4,] 0.7520838 0.7520907 0.7520993 0.7521102 0.7521238 0.7521408 0.7521622
#> [5,] 0.7063636 0.7063693 0.7063763 0.7063852 0.7063964 0.7064104 0.7064279
#> [,15] [,16] [,17] [,18] [,19] [,20] [,21]
#> [1,] 0.6801015 0.6801381 0.6801831 0.6802394 0.6803097 0.6803971 0.6805055
#> [2,] 0.7236718 0.7237117 0.7237610 0.7238226 0.7238994 0.7239949 0.7241133
#> [3,] 0.7038308 0.7038669 0.7039115 0.7039671 0.7040365 0.7041227 0.7042296
#> [4,] 0.7521894 0.7522231 0.7522653 0.7523179 0.7523833 0.7524646 0.7525651
#> [5,] 0.7064499 0.7064778 0.7065122 0.7065550 0.7066082 0.7066740 0.7067550
#> [,22] [,23] [,24] [,25] [,26] [,27] [,28]
#> [1,] 0.6806396 0.6808046 0.6810064 0.6812517 0.6815562 0.6819145 0.6823388
#> [2,] 0.7242595 0.7244391 0.7246584 0.7249283 0.7252505 0.7256346 0.7260868
#> [3,] 0.7043615 0.7045235 0.7047210 0.7049601 0.7052547 0.7055989 0.7060022
#> [4,] 0.7526888 0.7528403 0.7530245 0.7532498 0.7535167 0.7538318 0.7541984
#> [5,] 0.7068542 0.7069748 0.7071202 0.7072962 0.7075019 0.7077405 0.7080120
#> [,29] [,30] [,31] [,32] [,33] [,34] [,35]
#> [1,] 0.6828349 0.6834234 0.6840814 0.6848332 0.6856495 0.6865313 0.6874934
#> [2,] 0.7266115 0.7272208 0.7278970 0.7286483 0.7294488 0.7302863 0.7311518
#> [3,] 0.7064669 0.7070059 0.7075923 0.7082358 0.7088982 0.7095754 0.7102165
#> [4,] 0.7546226 0.7550947 0.7556159 0.7561688 0.7567442 0.7573162 0.7578685
#> [5,] 0.7083172 0.7086445 0.7089855 0.7093287 0.7096490 0.7099286 0.7101415
#> [,36] [,37] [,38] [,39] [,40] [,41] [,42]
#> [1,] 0.6884812 0.6895273 0.6905975 0.6916573 0.6927402 0.6938079 0.6948356
#> [2,] 0.7320012 0.7328317 0.7336033 0.7343087 0.7349384 0.7354874 0.7359552
#> [3,] 0.7108079 0.7112958 0.7116660 0.7118810 0.7119207 0.7117739 0.7114393
#> [4,] 0.7583742 0.7588103 0.7591547 0.7593859 0.7594838 0.7594269 0.7592182
#> [5,] 0.7102673 0.7102881 0.7101945 0.7099868 0.7096764 0.7092852 0.7089361
#> [,43] [,44] [,45] [,46] [,47] [,48] [,49]
#> [1,] 0.6957910 0.6966350 0.6973285 0.6975680 0.6975861 0.6975362 0.6974357
#> [2,] 0.7363445 0.7366601 0.7369081 0.7370951 0.7372280 0.7372728 0.7372589
#> [3,] 0.7109261 0.7102550 0.7094566 0.7085850 0.7077963 0.7074325 0.7071138
#> [4,] 0.7590709 0.7590085 0.7589110 0.7587729 0.7585006 0.7582186 0.7579698
#> [5,] 0.7086468 0.7083285 0.7080074 0.7076817 0.7073490 0.7069950 0.7066167
#> [,50] [,51] [,52] [,53] [,54] [,55] [,56]
#> [1,] 0.6972966 0.6971301 0.6969371 0.6967450 0.6965519 0.6963327 0.6961333
#> [2,] 0.7371886 0.7370851 0.7369552 0.7368366 0.7367117 0.7365883 0.7364216
#> [3,] 0.7067719 0.7064535 0.7061859 0.7060465 0.7060677 0.7061468 0.7062793
#> [4,] 0.7577342 0.7575314 0.7573561 0.7572131 0.7571673 0.7571082 0.7570828
#> [5,] 0.7061001 0.7055876 0.7051329 0.7046157 0.7040396 0.7034078 0.7027304
#> [,57] [,58] [,59] [,60] [,61] [,62] [,63]
#> [1,] 0.6959509 0.6958019 0.6956669 0.6955510 0.6954528 0.6954206 0.6953946
#> [2,] 0.7362248 0.7360179 0.7357707 0.7355237 0.7352741 0.7352434 0.7352168
#> [3,] 0.7064860 0.7067380 0.7070216 0.7073043 0.7075669 0.7078092 0.7080152
#> [4,] 0.7571121 0.7571668 0.7572314 0.7573020 0.7573737 0.7574386 0.7574961
#> [5,] 0.7020258 0.7013347 0.7006715 0.7000744 0.6995449 0.6990547 0.6986247
#> [,64] [,65] [,66] [,67] [,68] [,69] [,70]
#> [1,] 0.6953761 0.6953590 0.6953469 0.6953352 0.6953249 0.6953195 0.6953137
#> [2,] 0.7351940 0.7351750 0.7351664 0.7351581 0.7351505 0.7351437 0.7351377
#> [3,] 0.7081949 0.7083384 0.7084603 0.7085522 0.7086292 0.7086912 0.7087396
#> [4,] 0.7575455 0.7575895 0.7576242 0.7576521 0.7576776 0.7576959 0.7577089
#> [5,] 0.6982867 0.6980004 0.6977647 0.6975737 0.6974210 0.6973008 0.6972084
#> [,71] [,72] [,73] [,74] [,75] [,76] [,77]
#> [1,] 0.6953083 0.6953034 0.6952991 0.6952953 0.6952920 0.6952892 0.6952866
#> [2,] 0.7351326 0.7351282 0.7351245 0.7351215 0.7351190 0.7351170 0.7351154
#> [3,] 0.7087855 0.7088181 0.7088398 0.7088612 0.7088818 0.7088919 0.7089020
#> [4,] 0.7577219 0.7577338 0.7577440 0.7577490 0.7577540 0.7577589 0.7577633
#> [5,] 0.6971401 0.6970737 0.6970306 0.6969883 0.6969478 0.6969281 0.6969085
#> [,78] [,79] [,80] [,81]
#> [1,] 0.6952843 0.6952821 0.6952802 0.6952783
#> [2,] 0.7351142 0.7351132 0.7351124 0.7351119
#> [3,] 0.7089119 0.7089215 0.7089307 0.7089394
#> [4,] 0.7577673 0.7577708 0.7577738 0.7577763
#> [5,] 0.6968893 0.6968706 0.6968526 0.6968355