lpls: Function for lpls data exploration and regression

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/lpls.R

Description

This function allows statistical analysis of three data matrices arranged in an L-shape to be modelled by lpls. Two versions of lpls is implemented, exo- and endo-lpls. See references for details.

Usage

1
2
lpls(X1, X2, X3, npc = 2, doublecenter = TRUE, scaledata = c(FALSE, FALSE, FALSE), 
type = c("exo"), impute = FALSE, niter = 25, subsetX1 = NULL, subsetX3 = NULL)

Arguments

X1

A data matrix with n rows and q columns.

X2

A data matrix with n rows and p columns.

X3

A data matrix with p rows and m columns.

npc

The number of latent components to be extracted from each matrix

doublecenter

Logical, whether X2 should be both row- and column-centered. If FALSE the matrix is only centered using the overall mean.

scaledata

A logical vector with three elements indicating whether the columns of the three matrices should be standardized with the standard deviation.

type

Type of lpls. Character, either "endo", "exo" or "exo_ort". The latter is the exo-lpls with orthogonal scores. Prediction is only implmented for the non-orthogonal exo-lpls.

impute

Logical. Should missing values be imputed by SVD before analysis? If FALSE the missing values will be ignored in the NIPALS projections. If cross-validation is to be performed impute=TRUE must be used.

niter

The latent vectors are found using the NIPALS algorithm. This parameter defines the number of iterations for the NIPALS.

subsetX1

an optional vector specifying a subset of observations (rows of X1 and X2) to be used in the fitting process

subsetX3

an optional vector specifying a subset of variables (columns of X2 and rows X3) to be used in the fitting process

Details

See chapter Three-block data modeling by endo- and exo-LPLS regression by S?b?, S., Martens, M and Martens, M. for details on the endo- and exo-LPSL algorithms. Endo-LPLS is an inward regression of X1 and X3 on X2, whereas exo-LPSL is an outward regression of X2 on X1 and X3. The exo_ort algorithm returns orthogonal scores and should be chosen for visual exploration in correlation loading plots. If exo-LPSL with prediction is the main purpose of the model then the non-orthogonal exo type LPSL should be chosen for which the predict function has prediction implemented.

Value

call

The function call

ncomp

The number of components extracted

coefficients

Regression coefficient matrices: B1 = The matrix of regression coefficients for predicting X1 from X2 if type is exo_ort B3 = The matrix of regression coefficients for predicting X3 from X2 if type is exo_ort. C = A matrix of regression coeficients for predicting X2 from X1 and X3 in case of type is endo.

scores

The latent (normalized) scorevectors as extracted from NIPALS. One set for each extracted component of the LPLS model. Thus, all scores matrices have npc number of columns. Score-matrices T11 and T12 correspond to matrix X1, T21 and T22 to matrix X2, and T31 and T32 to matrix X3.

loadings

Loading matrices: P1=Loading(s) for X1 (endo-LPLS), P21 and P22 =Loading(s) for X2 (exo-LPSL), P3=Loading(s) for X3 (endo-LPLS), and D = Kernel loadings for X2 (endo-LPLS).

corloadings

Correlation loadings parallel to the regular P-loadings but without dimension. R1 = Correlation loadings for X1, R21 and R22 = Correlation loadings for X2, and R3 = Correlation loadings for X3, R2rmean=Correlation loadings for the row means of X2, R2cmean=Correlation loadings for the col means of X2.

means

mX1=The column means of matrix X1,mX3=The column means of matrix X3, rowmX2=The row means of matrix X2, colmX2=The column means of matrix X2,grandmX2=The overall mean of matrix X2.

data

The original data matrices.

residuals

The residual matrices after subtracting the contribution from the npc components.

options

Doublecenter = Logical. TRUE if doublecentering of X2 was performed. scaledata = Logical vector. TRUE if respective data matrix was column scaled. type = The chosen type of lpls. Either "endo", "exo" or "exo_ort"

vars

Proportions of explained un-corrected sums of squares for each component for each data matrix.

Author(s)

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

References

S<c3><a6>b<c3><b8>, S., Martens, M. and Martens H. (2010) Three-block data modeling by endo- and exo-LPLS regression. In Handbook of Partial Least Squares: Concepts, Methods and Applications. Esposito Vinzi, V.; Chin, W.W.; Henseler, J.; Wang, H. (Eds.). Springer.

See Also

plot.lpls,predict.lpls,lplsCV,

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
    
    #Simulating data
    simdata <- lpls.sim()
    X1 <- simdata$X1
    X2 <- simdata$X2
    X3 <- simdata$X3
    
    #To run exo-LPLS with orthogonal scores:
    fit.exo <- lpls(X1,X2,t(X3), npc=2, type="exo_ort")
    #Correlation plots:
    plot(fit.exo)

    #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")

    #Correlation loadings plots
    plot(fit.endo)

    #Predict X2 from X1 and X3:
    predict(fit.endo,X1new=X1,X3new=t(X3))

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