
Predict method for experimental plsRmulti models
predict.plsRmultiModel.RdPrediction method for "plsRmultiModel" objects.
Arguments
- object
An object of class
"plsRmultiModel".- newdata
Optional predictor matrix or data frame. For formula-fitted models, a data frame with the predictor variables used at fit time.
- comps
Number of extracted components to use.
- type
Either
"response"or"scores".- verbose
Should informational messages be displayed?
- ...
Not used.
Value
If type = "response", a matrix of predicted responses. If
type = "scores", a matrix of latent score coordinates.
Examples
set.seed(123)
X <- matrix(rnorm(40 * 3), ncol = 3)
Y <- cbind(
y1 = X[, 1] + rnorm(40, sd = 0.1),
y2 = X[, 2] - X[, 3] + rnorm(40, sd = 0.1)
)
fit <- plsRmulti(Y, X, nt = 2, verbose = FALSE)
predict(fit, type = "response")
#> y1 y2
#> 1 -0.5995617 -0.71354327
#> 2 -0.2467747 -0.59806489
#> 3 1.5072780 -0.92110100
#> 4 0.1446257 1.57138687
#> 5 0.1619663 1.45885644
#> 6 1.6749922 -1.48261272
#> 7 0.4462620 -1.51431413
#> 8 -1.2963435 -0.91151638
#> 9 -0.6750579 1.12835257
#> 10 -0.4530946 -1.23870005
#> 11 1.2368173 -0.74030324
#> 12 0.3542017 -0.57953909
#> 13 0.3925190 -0.28264847
#> 14 0.1460771 2.03310150
#> 15 -0.5674901 -1.59733716
#> 16 1.8369683 2.15431874
#> 17 0.4496116 -3.78338153
#> 18 -1.9548598 -0.93985156
#> 19 0.6972566 0.36483413
#> 20 -0.4858052 1.25615994
#> 21 -1.0756581 1.10634607
#> 22 -0.2462684 -0.76994014
#> 23 -1.0562498 -0.08925102
#> 24 -0.7834233 -0.68900337
#> 25 -0.6855195 -0.13572313
#> 26 -1.6956333 0.35980188
#> 27 0.8421715 1.24895692
#> 28 0.1329203 1.73424207
#> 29 -1.1239659 1.32908574
#> 30 1.3320211 1.17197022
#> 31 0.3957792 0.07817801
#> 32 -0.3873740 -2.97075232
#> 33 0.9139757 2.65715976
#> 34 0.8458043 -0.66852086
#> 35 0.7940612 -1.22532145
#> 36 0.7215805 0.74673853
#> 37 0.5366181 -0.39632924
#> 38 -0.1224726 -0.60158833
#> 39 -0.3180145 1.04270803
#> 40 -0.4059788 0.89088806
predict(fit, type = "scores")
#> Comp_1 Comp_2
#> 1 -0.80979817 -0.356072659
#> 2 -0.54057735 -0.054431798
#> 3 0.20504266 1.784050716
#> 4 1.10719975 -0.490464220
#> 5 1.04231170 -0.431009756
#> 6 -0.07434708 2.160170621
#> 7 -0.76716365 0.969698956
#> 8 -1.32163379 -0.963202968
#> 9 0.36620424 -1.125345984
#> 10 -1.07677928 -0.014470769
#> 11 0.17664245 1.451118197
#> 12 -0.19972200 0.526691907
#> 13 0.01744068 0.452100778
#> 14 1.41313417 -0.663360398
#> 15 -1.37634865 0.008981811
#> 16 2.41781857 0.945587827
#> 17 -2.26492733 1.829644444
#> 18 -1.70043463 -1.596931932
#> 19 0.61198246 0.505866527
#> 20 0.55415315 -0.988395076
#> 21 0.13261361 -1.509066559
#> 22 -0.65389045 0.010953815
#> 23 -0.64692758 -1.038685783
#> 24 -0.89411498 -0.545265166
#> 25 -0.47492624 -0.658342427
#> 26 -0.69976747 -1.833925177
#> 27 1.27552594 0.313887582
#> 28 1.20842801 -0.563403816
#> 29 0.25340463 -1.640434270
#> 30 1.49249460 0.822322029
#> 31 0.25768853 0.319064113
#> 32 -2.18553286 0.703765593
#> 33 2.24544998 -0.147499849
#> 34 0.01027780 1.041370422
#> 35 -0.38599693 1.200949900
#> 36 0.87767802 0.385485160
#> 37 0.02110353 0.636035958
#> 38 -0.47493794 0.068541051
#> 39 0.50483312 -0.743607446
#> 40 0.35639878 -0.772371357