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.02109235 -0.140739408 0.010823556 0.01806206 -0.05110977
#> 2 0.14588185 0.091759165 0.068309989 0.05755257 0.18283599
#> 3 -0.05487255 0.077422004 -0.012675127 0.02696307 -0.13568006
#> 4 0.10853875 -0.001283618 -0.072722095 0.05298505 0.11295735
#> 5 -0.06478269 0.138391833 -0.362364089 0.40363357 0.10911919
#> 6 0.09019382 0.194883374 -0.001348993 0.05592522 0.16678436
#> 7 0.21724053 -0.266879229 -0.144403097 -0.25589451 -0.14627001
#> 8 0.22510286 0.008260928 -0.019835272 -0.36236677 -0.07183367
#> 9 -0.37584676 -0.454570789 0.147485635 -0.19841825 0.05077730
#> 10 0.04163826 -0.247817825 0.013331446 -0.25535965 0.38747633
#> 11 -0.14788543 0.091346852 -0.109785506 0.34868582 0.19650240
#> 12 0.09067731 -0.327098774 -0.259974109 -0.10841294 -0.01491237
#> 13 0.60450542 0.008600252 0.107774317 0.33476565 -0.21483769
#> 14 0.06390106 0.259902512 0.074019023 0.29485704 0.04191463
#> 15 0.46498191 0.084644064 -0.053223378 -0.06935557 0.06030606
#> 16 0.13544878 -0.274485054 -0.014056309 0.14610438 0.55437835
#> 17 -0.11075052 0.394074119 0.022836355 -0.01314795 -0.43411612
#> 18 -0.45074566 -0.149666190 -0.058476962 0.02640080 0.40533566
#> 19 0.30505878 -0.294654861 -0.407430825 -0.35976141 0.08148388
#> 20 0.40794095 0.160414120 -0.005786607 0.18361045 0.08666650
## 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.08599746 -0.18037270 0.16219734 -0.248126837 -0.056951948
#> 2 -0.37603754 -0.17943883 -0.16181820 0.033185691 0.106276480
#> 3 -0.02694760 0.09865591 0.07134926 0.102603574 -0.094826440
#> 4 -0.43174872 -0.12827359 0.10996979 -0.134688730 -0.055209858
#> 5 -0.03489172 -0.44147218 -0.43219126 -0.136251934 -0.336296462
#> 6 -0.02246601 -0.16839153 -0.46226065 0.003729659 -0.060401416
#> 7 0.22822012 0.37131764 0.28451952 -0.100882346 -0.244113998
#> 8 -0.43999200 -0.22107390 0.20903380 -0.157304491 -0.306004156
#> 9 -0.50992219 -0.21089404 -0.02392420 -0.059752601 0.293844903
#> 10 -0.23787372 -0.49026660 -0.19144661 0.104980497 0.205309407
#> 11 0.07616158 0.45799089 -0.16879876 0.133274301 -0.044222735
#> 12 -0.40031974 -0.30721225 -0.03542759 -0.539513751 -0.348314592
#> 13 -0.37345206 -0.10298770 0.11250036 0.082216497 0.119373208
#> 14 -0.18026230 -0.21698006 0.04097709 0.031122360 -0.001512048
#> 15 -0.22143108 0.12768699 -0.07089876 -0.532103907 0.051120890
#> 16 -0.04448354 0.10322996 -0.25937396 -0.427309465 -0.170463811
#> 17 -0.19323160 0.07433083 0.20903571 0.254430455 0.130681696
#> 18 0.12606937 -0.11701547 -0.14932989 -0.057484554 -0.156470202
#> 19 -0.55855625 -0.20264704 -0.29904960 0.158152600 -0.228738473
#> 20 -0.21960653 -0.31580880 0.09637874 -0.194373025 -0.291984132
