Gene expression data from Khan et al. (2001). This data set contains 83 samples with 2308 genes: 29 cases of Ewing sarcoma (EWS), coded 1, 11 cases of Burkitt lymphoma (BL), coded 2, 18 cases of neuroblastoma (NB), coded 3, 25 cases of rhabdomyosarcoma (RMS), coded 4. A total of 63 training samples and 25 test samples are provided in Khan et al. (2001). Five of the test set are non-SRBCT and are not considered here. The training sample indexes correspond to 1:65 and the test sample indexes (without non-SRBCT sample) correspond to 66:83.
library(plsgenomics)
# For any news related to the 'plsgenomics' package (update, corrected bugs), please check https://github.com/gdurif/plsgenomics
library(MultiGroupO)
data(SRBCT)
mydata<-SRBCT$X
mydata<-mydata[,1:5]
groups<-as.factor(SRBCT$Y)
pca(datos=mydata,grupos=groups,Plot=TRUE,center=TRUE,scale=TRUE)
# $loadings
# PC1 PC2 PC3 PC4 PC5
# [1,] -0.3853353 0.2400701 0.76059996 0.43733190 0.155279059
# [2,] -0.4444842 0.4247842 0.09015326 -0.78347750 0.005253247
# [3,] 0.3227085 -0.5951899 0.58350325 -0.43798941 0.096422977
# [4,] 0.5333248 0.4529326 0.01106092 -0.05094667 0.712529858
# [5,] -0.5151450 -0.4500286 -0.26974376 0.02176068 0.677395474
#
# $variates
# PC1 PC2 PC3 PC4 PC5
# [1,] -1.406957352 -0.76339469 0.927097361 1.294672092 0.66757421
# [2,] 0.088045884 -0.34531694 0.237709302 0.573122797 -0.93974973
# [3,] -0.880526378 0.04633629 1.234055994 1.299176865 -0.30316222
# [4,] -0.360263552 -0.05657513 -0.926182168 0.440867103 -0.64971761
# [5,] -1.241068087 0.34542842 0.217748557 1.136540110 0.07622766
# [6,] -0.716001881 -0.60774253 0.097190304 0.838568962 0.04303317
# [7,] -0.484461042 -0.56604567 0.064787547 0.584880009 0.05550315
# [8,] -1.432068303 -0.10887173 0.136115186 1.185861782 0.59292563
# [9,] -0.908936383 -0.42755182 0.167476767 1.065744335 0.23379500
# [10,] -0.819979264 0.02532283 -0.141456253 0.627801171 -0.27583850
# [11,] -1.524067959 0.05883388 0.940986082 1.679469800 0.65009741
# [12,] -1.088510226 -0.32377897 -0.288871205 1.112663884 0.39911816
# [13,] -0.900809093 -0.03748096 -0.066382703 0.971939803 0.77925813
# [14,] 1.492600655 -0.04866498 0.324359688 -0.474728460 0.80215002
# [15,] -0.577860919 -0.75740550 -0.881399320 0.187496005 -0.17851454
# [16,] -0.518524903 -1.87522358 -0.487529916 -0.049135993 0.47188755
# [17,] -0.551422940 -1.37482851 1.319253917 0.437765315 0.47667414
# [18,] 2.170173453 -0.36346605 1.059977142 -0.879361668 0.56656661
# [19,] 1.952169488 -0.13857031 0.794521610 -0.626246924 0.39616949
# [20,] 1.833377285 0.93482522 0.437675503 0.360279974 0.56005070
# [21,] -0.627418265 -0.08257983 0.107542124 1.053404948 -0.50020463
# [22,] 1.303226056 0.48427243 -0.963791616 0.114709287 -0.33960050
# [23,] 1.668390645 -0.16402883 0.653246516 -0.418946513 -0.05828289
# [24,] 1.420350584 -0.04896606 -0.943322155 -0.189215953 1.01084450
# [25,] 2.448473656 0.01865666 -0.096387573 -0.795912291 0.27998976
# [26,] 1.546650140 1.11039240 -1.560664681 0.237205320 0.08875148
# [27,] 2.254334640 0.78312464 -0.575067759 -0.058717349 -0.25429497
# [28,] 0.144053906 -1.25446073 -1.228416338 -0.065155598 -0.25627010
# [29,] 0.653143083 -1.76817435 -0.255474385 -0.519088609 -0.34702191
# [30,] 0.158854109 -1.51271367 -0.880842788 -0.195772040 0.38136790
# [31,] -0.957664712 -1.49170169 -2.117309105 0.115562394 0.73055932
# [32,] -0.454875842 -1.28350621 -0.063380143 -0.181635289 0.13557867
# [33,] 0.194554792 -2.78635216 1.050611723 -0.901938860 0.58474689
# [34,] 0.179874054 -0.77790456 -0.469617645 -0.037254749 -0.52770105
# [35,] 2.027813857 1.31692912 -0.646603765 0.244849520 0.47821756
# [36,] 1.839619673 0.83228000 0.807293918 -0.202372283 1.31058544
# [37,] 2.944525656 -0.75405018 2.091416534 -1.236019328 0.78046893
# [38,] 1.832093240 0.12646137 -0.008656911 -0.209146880 -0.42537578
# [39,] 1.467912121 1.27267276 -1.052350386 0.335231526 0.04415075
# [40,] 1.609884035 0.52734889 0.301885221 -0.004804155 0.01102314
# [41,] 2.154352287 0.84072252 0.431900352 0.120989114 0.19977327
# [42,] 2.114788884 0.03539266 0.529790434 -0.522584163 0.50657167
# [43,] 1.791845475 1.17170288 -0.798824267 -0.103042493 0.76610338
# [44,] 0.123345370 0.45888908 1.160562767 1.095947276 -0.69094313
# [45,] -1.227068054 0.50281223 -0.396797664 0.760822472 -0.09383407
# [46,] 1.060634828 1.91753828 -0.635871901 0.427058953 0.73999561
# [47,] 1.533765584 1.33407877 -0.054949585 0.312893277 0.35209633
# [48,] 0.705472675 1.58903546 -0.730509154 0.253324413 0.54962418
# [49,] 1.431586487 0.97127574 -0.217738914 -0.507092334 0.39478771
# [50,] 0.920931574 1.29571425 -0.363347370 0.611447195 0.08789009
# [51,] -2.750163443 -0.73357625 -1.481307108 -1.141750055 1.39983574
# [52,] 1.545537774 1.31411015 0.134906440 0.651180753 -0.34520243
# [53,] -1.931913227 0.57485780 0.687983543 -1.011038043 0.01022203
# [54,] -2.913941922 0.60504728 -1.210786202 -1.871773426 0.60430085
# [55,] -2.766247852 1.79666894 1.106263656 -0.716365775 -0.17687473
# [56,] -2.900015201 -0.26012630 -0.470163067 -0.649590826 1.20465386
# [57,] -0.630994153 1.41107214 1.033131603 0.924989309 -0.90592588
# [58,] -2.022015736 -0.05100951 -0.652137885 0.194476816 1.21999600
# [59,] -3.200460796 2.15034007 0.168377495 -2.582287572 0.02281737
# [60,] -1.125464254 0.17073326 -0.146614969 -0.052343255 0.22819766
# [61,] -0.900007504 -0.42936289 -0.383740555 -0.335086903 -0.16185827
# [62,] -0.791287142 1.28106371 -0.526667310 -0.562702221 -1.15559439
# [63,] -0.804417620 0.48087987 0.666337694 -0.607512136 -0.76336964
# [64,] 0.479559625 -0.46601546 -0.245249549 -0.164611613 -1.08598697
# [65,] 0.108707453 0.31636780 -1.187789251 -0.209241941 -1.35511092
# [66,] 0.120246080 -1.02517069 0.423671590 -0.614532712 -0.66346894
# [67,] 0.311030597 -1.69231060 3.104502149 -0.161586214 -0.18989591
# [68,] -1.731462359 1.42043190 0.818941954 -1.559787805 -0.69923977
# [69,] 0.477959894 -1.18021521 -0.831420495 -0.345997003 -0.71105359
# [70,] -1.292298171 0.59545754 2.020673719 1.724009270 -0.20448036
# [71,] -1.550747523 -0.14650834 -1.151744149 0.132062561 0.39955053
# [72,] -0.648033683 -0.31142109 0.015664892 0.733469975 -0.03887057
# [73,] -0.805240565 0.03056610 -0.153571981 0.627994083 -0.29276549
# [74,] -0.578896592 -0.25292265 1.336412897 0.904381965 -0.04311459
# [75,] -2.425497244 2.11280577 2.248059334 -1.830980132 -0.41696121
# [76,] 1.230864908 -1.40113560 -0.030806752 -0.734906843 -1.03695419
# [77,] -0.622907887 0.14731038 -1.301687792 0.196703885 -0.67678092
# [78,] 0.451238661 -1.80509900 0.498131086 -0.903007385 -0.29399373
# [79,] 0.341532552 -0.72289691 -0.275633756 -0.454880668 -0.92334120
# [80,] 0.539381619 -1.27864896 0.268077804 -0.983079469 -0.53645510
# [81,] 0.003776952 -0.54462973 -0.297802525 -0.489986807 -0.62746189
# [82,] 0.483080781 0.03481055 -1.427725977 0.236977664 -1.44961741
# [83,] -0.089263044 -0.42216518 -0.997745409 0.354678755 -0.69884192
#
# $prop_expl_var
# [1] 0.41242666 0.20418620 0.17296671 0.13076232 0.07965812
#
# attr(,"class")
# [1] "pca"
library(plsgenomics)
data(SRBCT)
mydata<-SRBCT$X
mydata<-mydata[,1:5]
groups<-as.factor(SRBCT$Y)
mat.to.diag1<-new.cov(x=mydata,cls=groups,A=diag(ncol(mydata)))
mgpca(mat.to.diag=mat.to.diag1,mat.x=as.matrix(mydata),cls=groups,Plot=TRUE,ncomp=2,center = TRUE,scale = TRUE)
# $variates
# [,1] [,2] [,3] [,4] [,5]
# [1,] -1.72403001 0.508402635 -0.45492278 0.828527233 1.191417771
# [2,] -0.20672447 0.134090675 -0.58738092 0.721960626 -0.684209083
# [3,] -1.81731150 0.346363923 -0.23726780 0.754159429 -0.180261753
# [4,] 0.15430112 -0.976150762 -0.57607111 0.537723073 -0.098069321
# [5,] -1.47808450 -0.606372349 -0.11903926 0.528329253 0.398492094
# [6,] -0.66302434 0.008941405 -0.53321498 0.748848978 0.558328904
# [7,] -0.40779846 0.085523590 -0.43749633 0.572500626 0.460107575
# [8,] -1.43343854 -0.422371202 -0.18924938 0.631522349 1.082242907
# [9,] -0.97354219 -0.097064020 -0.35750545 0.805146753 0.702999438
# [10,] -0.69729481 -0.553189472 -0.43842657 0.392986080 0.156024794
# [11,] -2.21297908 0.003891979 0.05806129 0.855311928 0.907041155
# [12,] -0.87144680 -0.534017411 -0.31190400 0.816298889 0.980932230
# [13,] -0.91423762 -0.355644661 0.16752769 0.561411297 1.031318093
# [14,] 0.96093811 1.015725867 1.10350709 -0.170498169 -0.048449470
# [15,] 0.30569733 -0.546982439 -0.88563856 0.437763728 0.618740572
# [16,] 0.54883989 0.483592318 -1.18173020 0.491095936 1.440611306
# [17,] -0.87820586 1.507868599 -0.65540354 0.460818420 0.816509430
# [18,] 1.22007262 1.986726277 1.08498489 -0.333758241 -0.579086640
# [19,] 1.06667904 1.528796821 1.04530951 -0.181661666 -0.640211428
# [20,] 0.47367378 0.564183541 1.90389483 0.325173793 -0.772635287
# [21,] -0.85902411 -0.343907328 -0.44013035 0.842752338 -0.108462792
# [22,] 1.19611234 -0.577209204 0.68906952 0.452637496 -0.739422910
# [23,] 0.89460669 1.222659484 0.65501500 0.014134844 -0.831633999
# [24,] 1.54114764 0.033502437 1.14627075 0.234381074 0.471306537
# [25,] 1.92292858 0.962156698 1.21765255 -0.108986029 -0.773677567
# [26,] 1.45772199 -1.195033714 1.42043752 0.447899251 -0.594642670
# [27,] 1.54993208 -0.053937157 1.38657624 0.366678809 -1.277450493
# [28,] 1.22030517 -0.275434527 -0.95695728 0.631096484 0.542485653
# [29,] 1.31424340 0.946530346 -1.08777376 0.396487395 0.211119292
# [30,] 1.15668535 0.253675542 -0.73656557 0.479263681 1.048186368
# [31,] 1.03951884 -1.069551242 -1.10482446 0.614338815 2.085611784
# [32,] 0.21426169 0.486112129 -0.97433203 0.160691516 0.807671026
# [33,] 0.72343166 2.497528693 -1.37148960 -0.018601970 1.191001611
# [34,] 0.64275356 0.015014971 -0.74010357 0.415622711 -0.063514599
# [35,] 1.16097600 -0.371169323 2.08180607 0.317773073 -0.795325645
# [36,] 0.51808311 1.110711933 2.20065384 -0.280720289 -0.251853955
# [37,] 1.37039724 3.326166798 1.36030902 -0.503039443 -0.839558330
# [38,] 1.21285912 0.542062574 0.69030436 0.286314342 -1.128700551
# [39,] 1.02143196 -0.945234047 1.51347908 0.385470403 -0.787550471
# [40,] 0.68444444 0.541939618 1.14422497 0.172811355 -0.927267727
# [41,] 0.80652999 0.692789313 1.74826320 0.270994745 -1.152746174
# [42,] 1.22935683 1.305377471 1.29589149 -0.081221023 -0.618636785
# [43,] 1.28453301 -0.395649111 1.96554481 -0.009589968 -0.386301095
# [44,] -1.18144527 0.403947280 0.24019641 0.743458556 -1.040091711
# [45,] -1.00602893 -1.118573267 -0.23301164 0.260914921 0.343436792
# [46,] 0.28395182 -0.992695195 2.16397324 -0.005298199 -0.432810089
# [47,] 0.46935352 -0.144991439 1.83478624 0.170768426 -0.848633519
# [48,] 0.28512312 -1.034731261 1.63624869 -0.098046757 -0.289382285
# [49,] 0.94131884 0.004590750 1.41692477 -0.433965021 -0.609198631
# [50,] 0.15321531 -0.667605970 1.38997787 0.371708166 -0.707973121
# [51,] -0.19492872 -1.316953907 -1.32152134 -1.387317961 2.848772114
# [52,] 0.23694663 -0.161122531 1.50247360 0.532658807 -1.433079495
# [53,] -1.39507175 -0.319061711 -0.72975302 -1.686183076 0.366872700
# [54,] -0.57031958 -1.883675330 -1.15879566 -2.481965252 1.677916021
# [55,] -2.66066014 -0.995918063 -0.40790041 -2.100146394 -0.021622735
# [56,] -1.22417886 -0.955328800 -1.04545755 -1.286698344 2.326397479
# [57,] -1.80685882 -0.456212673 0.28835290 0.119021588 -1.250105471
# [58,] -0.96557946 -1.001002342 -0.32917174 -0.365433006 1.966316405
# [59,] -1.74349451 -1.730272482 -0.71601292 -3.858099787 0.364373439
# [60,] -0.65919189 -0.552171573 -0.33658933 -0.393761962 0.603623490
# [61,] -0.07921936 -0.375778563 -0.89395612 -0.296846327 0.495321740
# [62,] -0.35593996 -1.450371229 -0.41937155 -0.919862587 -0.971792465
# [63,] -0.80009867 -0.079109525 -0.60752386 -0.917662497 -0.645397074
# [64,] 0.65861820 0.052884698 -0.73225661 0.302951778 -0.805732969
# [65,] 0.75414486 -1.224286246 -0.67008136 0.077666665 -0.938192185
# [66,] 0.39115249 0.848365921 -1.04216384 -0.145732763 -0.287584175
# [67,] -1.03557839 3.286493565 -0.79169134 0.062329865 -0.395773429
# [68,] -1.38045341 -0.622164954 -0.61764540 -2.347540749 -0.650349592
# [69,] 1.29123898 0.064751175 -1.03452503 0.434522127 -0.085921121
# [70,] -2.87786572 0.469185378 0.09727047 0.702921070 -0.340501221
# [71,] -0.31853305 -1.296295622 -0.68321191 -0.094224200 1.293203755
# [72,] -0.62033377 -0.176675365 -0.39133568 0.593410628 0.367909362
# [73,] -0.68251182 -0.562687220 -0.43868244 0.398949336 0.137757269
# [74,] -1.43583245 0.785653466 -0.18979208 0.538263476 -0.015535958
# [75,] -2.75926509 -0.057114082 -0.31062410 -3.254925376 -0.786936068
# [76,] 1.52524315 1.045968122 -1.00271429 0.272498913 -0.770981786
# [77,] 0.24362116 -1.424996156 -0.67080577 0.246711853 -0.004253116
# [78,] 0.91146554 1.523635441 -1.19439611 -0.103377739 0.149948492
# [79,] 0.78416949 0.180753104 -0.92150442 0.085719017 -0.520155909
# [80,] 0.97368533 1.085472571 -1.00083079 -0.268960435 -0.227277194
# [81,] 0.54206248 0.010775882 -0.81428063 -0.123671481 -0.216384428
# [82,] 1.03815982 -1.209389165 -0.64751266 0.711474928 -0.982172157
# [83,] 0.51459855 -0.744710351 -0.71844086 0.672919867 -0.086490946
#
# $loadings
# [,1] [,2] [,3] [,4] [,5]
# [1,] -0.93921916 0.27678629 0.19056337 0.07027279 0.002015891
# [2,] -0.14846641 -0.19210171 -0.09662235 -0.96495034 -0.024282003
# [3,] 0.22168438 0.93454616 -0.19067352 -0.20161311 0.021800808
# [4,] 0.21207162 0.10600135 0.94579078 -0.15249441 0.161290425
# [5,] -0.04131301 -0.04328361 -0.15320947 0.00549353 0.986365269
#
# $prop_expl_var
# [1] 26.52 20.79
#
# attr(,"class")
# [1] "mgpca"
library(plsgenomics)
data(SRBCT)
mydata<-SRBCT$X
mydata<-mydata[,1:5]
groups<-as.factor(SRBCT$Y)
mydata<-split(as.data.frame(mydata),groups)
mdr(group=groups,data.x=mydata,c=2)
# $variates
# V1 V2
# 1 3.12202176 -0.821840479
# 2 1.59601843 -0.815421086
# 3 3.19351655 -0.675033314
# 4 0.96173934 -0.248191188
# 5 2.62641826 -0.186473588
# 6 1.99336399 -0.697375665
# 7 1.76629017 -0.763485594
# 8 2.62973615 -0.321697736
# 9 2.28264534 -0.590075377
# 10 1.86028044 -0.336384244
# 11 3.51718635 -0.441444760
# 12 2.08399635 -0.366983036
# 13 2.19519126 -0.428479665
# 14 0.81774008 -1.400475271
# 15 0.87611500 -0.529004301
# 16 0.87157853 -1.176914092
# 17 2.51859002 -1.489369550
# 18 0.79927593 -1.964447242
# 19 0.84147391 -1.694077685
# 20 1.31135152 -1.071361224
# 21 2.11366050 -0.458186627
# 22 0.22782228 -0.590485766
# 23 0.90382926 -1.515588029
# 24 3.05356781 -2.408330961
# 25 4.24802863 -0.554183285
# 26 1.90789878 -0.579941444
# 27 1.84484902 -0.333574180
# 28 2.92707061 -0.969156826
# 29 0.68099806 -0.452015376
# 30 0.07902264 -0.986420975
# 31 -0.06985239 -1.514802041
# 32 -0.08656825 -0.270430892
# 33 0.10102938 -0.906384146
# 34 0.10277898 -0.847239929
# 35 0.27888174 -1.526406320
# 36 0.29923080 -1.126845238
# 37 0.04741245 -0.406547431
# 38 0.09384939 -1.022781851
# 39 0.10817210 -1.583933587
# 40 0.09437601 -0.259207594
# 41 1.17583097 -1.078191735
# 42 1.13121560 -2.295174559
# 43 0.71875988 -0.880029695
# 44 0.45768545 -0.653024251
# 45 1.37024418 -1.340190390
# 46 1.00538890 -2.715296664
# 47 0.47357144 -1.200251812
# 48 0.38764563 -0.327760965
# 49 1.00568606 -1.097142484
# 50 1.01066255 -1.189705730
# 51 0.67397690 -1.597442927
# 52 0.28474238 -0.644696642
# 53 0.70601123 -0.878932571
# 54 1.06511637 -1.264522535
# 55 0.73125839 -1.745627267
# 56 0.57328484 -0.964640487
# 57 0.57087070 -1.483461202
# 58 0.74497419 -0.816276902
# 59 2.67267029 -0.780445452
# 60 2.01664477 0.043711589
# 61 1.09467821 -0.139665161
# 62 1.11523969 -0.659996537
# 63 1.01141553 -0.125191926
# 64 0.59592249 -0.788236205
# 65 1.25092103 -0.345112431
# 66 0.89036181 0.074664639
# 67 1.33282685 -0.638146291
# 68 2.30740446 -0.197582836
# 69 1.00584282 0.571725222
# 70 3.31532714 0.439825462
# 71 1.98670759 0.050155344
# 72 2.98186403 -0.138733308
# 73 1.91933878 -0.015127747
# 74 2.04687561 0.827889538
# 75 1.74805569 -0.286574117
# 76 1.19721947 -0.500400564
# 77 1.18396499 0.241875198
# 78 1.91516519 -0.467418666
# 79 0.28362805 -0.154640916
# 80 2.16479920 0.047981812
# 81 1.23465926 0.028026774
# 82 3.52898464 0.040489155
# 83 0.72383697 0.008385486
#
# $loadings
# [,1] [,2]
# [1,] 0.98614287 -0.002436152
# [2,] -0.06903002 0.560697342
# [3,] -0.02923694 -0.819796115
# [4,] -0.14390561 -0.109894629
# [5,] 0.03454657 0.038341319
#
# $prop_expl_dim
# [1] 66.78 25.87 7.36 0.00 0.00
#
# attr(,"class")
# [1] "mdr"