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.0956879341 0.0279979689 0.254553127 -0.20193311 0.372619988
#> 2 0.0833929632 -0.4962188602 0.232072255 -0.40007762 -0.048277292
#> 3 -0.2209111593 -0.3789578210 -0.265130232 0.41749397 0.090635860
#> 4 0.2056488661 0.1183189413 0.125561003 0.28356081 0.283164381
#> 5 0.1055928740 0.2860169593 -0.118665530 0.06447895 0.086311413
#> 6 -0.2800987448 -0.1953040474 0.117424803 0.10605155 0.060383866
#> 7 0.3258235954 -0.0008825829 0.106083368 -0.04049953 0.042144895
#> 8 -0.2672798067 -0.0456541609 0.004593870 -0.02989406 0.098173656
#> 9 0.3402559564 0.2650799157 0.242686546 -0.26431395 -0.037504956
#> 10 -0.0732469533 -0.0225050075 0.009060602 0.08987267 -0.129424799
#> 11 0.1757378735 0.0446432909 -0.140156236 -0.12059411 0.193073919
#> 12 -0.0141047669 -0.0965732821 -0.250113519 -0.02371874 0.002093166
#> 13 0.5361230139 0.5099582182 -0.430786720 0.32686317 0.316156692
#> 14 -0.1942302739 -0.2284916675 -0.274899267 0.18733778 0.452279998
#> 15 0.1166171266 0.4224989673 0.115167960 0.07222169 -0.068633781
#> 16 0.0001191487 0.0622526785 -0.155207884 -0.19403751 0.338600563
#> 17 0.1940186001 0.1460002237 0.346695430 -0.04615080 -0.055123668
#> 18 -0.0572369158 0.1526957226 0.265280816 0.10603388 -0.266327155
#> 19 0.1058543734 0.0063985693 0.014993709 -0.03616636 -0.072305034
#> 20 -0.3283488641 0.3544576498 -0.206644429 0.35365572 0.355073545
## 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.29654499 -0.2289097501 -0.24870323 0.25668396 -0.03602424
#> 2 -0.25291961 -0.1054244998 0.43237819 0.38718899 -0.19563702
#> 3 -0.12574015 0.1662635067 0.09964988 -0.10556479 -0.26069253
#> 4 0.17395135 -0.3613262412 0.01810161 -0.18113925 -0.10867544
#> 5 0.61980868 -0.0764134636 -0.17550525 0.34994980 0.17345943
#> 6 -0.25721389 -0.3803768988 0.11581624 0.48689718 0.04374536
#> 7 0.05827802 0.3848274396 0.20863267 -0.16814351 -0.32815504
#> 8 0.05655776 -0.3991275826 -0.14189122 0.01944858 -0.27069860
#> 9 0.27318270 -0.3249309127 -0.29138191 0.09613743 -0.43745504
#> 10 0.09479748 -0.0760288619 0.11154036 0.15948610 -0.64532101
#> 11 -0.01357717 0.0904929742 0.31194586 0.20623745 -0.10969948
#> 12 -0.09470302 -0.4647730897 0.01713416 0.29708088 -0.08656292
#> 13 0.17628526 -0.0006131745 0.13122977 0.38354656 -0.01406942
#> 14 -0.13269737 -0.1231373438 -0.30069322 -0.06986251 0.14452971
#> 15 0.08444287 0.1869853387 0.15658105 -0.02870837 -0.18504246
#> 16 -0.05848652 0.1871203992 -0.31101087 -0.09131797 -0.26675384
#> 17 -0.03561985 -0.1259309775 -0.03464557 -0.54798701 -0.06772222
#> 18 0.42250528 -0.1923639005 0.07124868 0.50485144 -0.15047237
#> 19 0.44168501 -0.2089583229 0.18275110 0.12302977 -0.44598080
#> 20 0.41244359 0.0658082667 0.05747569 -0.01678837 -0.40353352