Predict the projection of new individuals/rows or variables/columns.
Usage
# S4 method for class 'CA'
predict(object, newdata, margin = 1)
# S4 method for class 'MCA'
predict(object, newdata, margin = 1)
# S4 method for class 'PCA'
predict(object, newdata, margin = 1)
Value
A data.frame
of coordinates.
Examples
## Create a matrix
A <- matrix(data = sample(1:10, 100, TRUE), nrow = 10, ncol = 10)
## Compute correspondence analysis
X <- ca(A, sup_row = 8:10, sup_col = 7:10)
## Predict new row coordinates
Y <- matrix(data = sample(1:10, 120, TRUE), nrow = 20, ncol = 6)
predict(X, Y, margin = 1)
#> F1 F2 F3 F4 F5
#> 1 -0.00478730 -0.041188329 0.61467580 -0.07379945 -0.117412555
#> 2 -0.09218019 0.190863599 0.07038407 0.08459084 0.001893532
#> 3 0.14780605 0.038614444 -0.03673148 -0.35308760 -0.245743210
#> 4 -0.09442708 0.055058731 0.10807567 0.30859411 -0.156125856
#> 5 -0.37177664 0.120862440 0.65933867 0.32434798 -0.366779279
#> 6 0.07790236 0.116582600 0.21266030 0.19724028 0.199336336
#> 7 0.30201666 -0.163002345 -0.09564004 -0.10547591 0.085394493
#> 8 0.62379579 -0.052425648 0.18362867 -0.04215614 0.002932787
#> 9 0.09556146 -0.065833223 0.21843956 0.13073446 -0.145574770
#> 10 -0.37202424 0.680543338 0.11860880 -0.27519813 -0.133280379
#> 11 -0.38478986 -0.003996842 0.39572237 0.23395841 -0.254636410
#> 12 -0.39041881 0.320438828 -0.05203969 -0.12961609 0.229341814
#> 13 0.20645307 0.374752264 0.15301794 -0.03845264 0.244953749
#> 14 -0.20106947 0.047879025 -0.14036712 -0.25969333 0.250815085
#> 15 0.30806732 0.021792602 0.41081308 -0.34232985 0.399063893
#> 16 0.19483911 0.236539792 -0.16007619 -0.05097245 -0.498739072
#> 17 0.12449068 0.157809188 0.29570350 0.21176447 -0.201378230
#> 18 0.16107766 -0.188957392 0.54296593 -0.13938986 0.268968383
#> 19 0.25760924 0.047988663 -0.07688950 0.60108850 -0.401404605
#> 20 0.03601531 0.066577916 0.29265869 0.15089625 -0.222565212
## Predict new column coordinates
Z <- matrix(data = sample(1:10, 140, TRUE), nrow = 7, ncol = 20)
predict(X, Z, margin = 2)
#> F1 F2 F3 F4 F5
#> 1 0.41770310 -0.18340696 -0.05638240 -0.10048350 0.24265252
#> 2 0.45507616 0.13057599 0.06408124 -0.15885416 -0.03986550
#> 3 -0.11646227 0.18590042 -0.48994388 -0.03848177 -0.15153501
#> 4 0.03234031 -0.02243677 0.17656717 -0.28390798 0.23162739
#> 5 0.15458941 -0.25633914 -0.34059703 -0.12529427 -0.06487952
#> 6 -0.03160722 0.08887754 0.06629717 0.10465828 -0.17560651
#> 7 -0.43761518 -0.10006713 -0.56227867 0.02311103 0.35316676
#> 8 0.03184870 -0.39868913 -0.22787271 0.18456120 0.02609875
#> 9 -0.10226096 0.16407770 -0.35218280 0.14606842 -0.11547918
#> 10 -0.12749181 0.09909558 -0.23773365 -0.14033899 0.01829664
#> 11 -0.02152775 0.11270289 -0.01930091 -0.27350705 0.09872964
#> 12 0.24134056 0.12335194 -0.23448812 -0.23781535 0.34686896
#> 13 0.07126504 -0.15035976 -0.50910270 0.06025939 -0.36938414
#> 14 0.26619017 0.11013720 -0.26520409 0.17737012 -0.02487129
#> 15 -0.40669069 0.02291560 -0.24249026 0.07793922 -0.11725374
#> 16 -0.47093698 0.05942306 -0.21975135 -0.04242656 0.05768544
#> 17 -0.17818705 -0.04661435 -0.21192824 -0.01846491 -0.10829349
#> 18 0.02339854 -0.39677720 -0.09889424 -0.30823261 -0.21222769
#> 19 -0.27805997 -0.17448804 0.13839135 0.07075069 -0.44703061
#> 20 -0.17656361 -0.17757239 -0.28465918 -0.24756393 -0.19459274