predict.lpls: lpls prediction

Description Usage Arguments Details Value Author(s) Examples

View source: R/predict.lpls.R

Description

Uses a fitted lpls-model for predictions. If the model is an endo-lpls model, the prediction is inadvert towards X2. Otherwise, in case of exo-lpls, the prediction is extrovert in the direction (X1 or X2) as specified by the user.

Usage

1
predict.lpls(obj, X1new = NULL, X2new = NULL, X3new = NULL, exo.direction = c("X1", "X3"))

Arguments

obj

A fitted model object of class “lpls”. This could be either an endo- or an exo-lpls model object.

X1new

New predictor values for X1 in case of endo-lpls. Also a new (or old) X3 must be specified.

X2new

New predictor values for X2 in case of exo-lpls. X2 must have the same number of columns as X2 used in model fit in case of prediction of X1, and the same number of rows as X2 in case of X3 prediction.

X3new

New predictor values for X3 in case of endo-lpls. Also a new (or old) X1 must be specified.

exo.direction

Applicable for exo-lpls prediction. If X1 is to be predicted then exo.direction = "X1", or if X3 is to be predicted, then exp.direction = "X3"

Details

If the corner matrix X2 has been double centered in the endo-LPLS-model fit, then the predictions may have a bias since the row- and/or column means of the new observations are not known. In such cases it may be a better option to use grand-mean centering of X2 only.

Value

A list object pred with element

pred

A vector or a matrix of predicted values

Author(s)

Solve S<c3><a6>b<c3><b8>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
    
    #Simulating data
    simdata <- lpls.sim()
    X1 <- simdata$X1
    X2 <- simdata$X2
    X3 <- simdata$X3

    #To run exo-LPLS with non-orthogonal scores:
    fit.exo <- lpls(X1,X2,t(X3), npc=2, type="exo")
    #Predict X1
    predict(fit.exo, X2new=X2, exo.direction="X1")
    #Predict X3
    predict(fit.exo, X2new=X2, exo.direction="X3")

    #To run endo-LPSL:
    fit.endo <- lpls(X1,X2,t(X3), npc=2, type="endo")
    #Predict X2 from X1 and X3 (in this case fitted values):
    predict(fit.endo,X1new=X1,X3new=t(X3))

solvsa/lpls documentation built on May 30, 2019, 6:10 a.m.