pls2B: Two-Block partial least square regression.

View source: R/pls2B.r

pls2BR Documentation

Two-Block partial least square regression.

Description

Performs a Two-Block PLS on two sets of data and assesses the significance of each score by permutation testing

Usage

pls2B(
  x,
  y,
  tol = 1e-12,
  same.config = FALSE,
  rounds = 0,
  useCor = FALSE,
  cv = FALSE,
  cvlv = NULL,
  mc.cores = parallel::detectCores(),
  ...
)

Arguments

x

array containing superimposed landmark data second block.Matrices are also allowed but the option 'same.config' will not work.

y

array containing superimposed landmark data of the first block. Matrices are also allowed but the option 'same.config' will not work.

tol

threshold for discarding singular values.

same.config

logical: if TRUE each permutation includes new superimposition of permuted landmarks. This is necessary if both blocks originate from landmarks that are superimposed together.

rounds

rounds of permutation testing.

useCor

if TRUE, the correlation matrix instead of the covariance matrix is used.

cv

logical: if TRUE, a leave-one-out cross-validation is performed

cvlv

integer: number of latent variables to test

mc.cores

integer: determines how many cores to use for the

...

arguments passed to ProcGPA computation. The default is autodetect. But in case, it doesn't work as expected cores can be set manually. Parallel processing is disabled on Windows due to occasional errors.

Details

The Two-Block PLS tries to find those linear combinations in each block maximising the covariance between blocks. The significance of each linear combination is assessed by comparing the singular value to those obtained from permuted blocks. If both blocks contain landmarks superimposed TOGETHER, the option same.config=TRUE requests superimposition of the permuted configurations (i.e. where the the landmarks of block x are replaced by corresponding landmarks of other specimen.

Value

svd

singular value decomposition (see svd) of the 'common' covariance block

Xscores

PLS-scores of x

Yscores

PLS-scores of y

CoVar

Dataframe containing singular values, explained covariation, correlation coeffictient between PLS-scores and p-values for singular values obtained from permutation testing

xlm

linear model: lm(Xscores ~ Yscores - 1)

ylm

linear model: lm(Yscores ~ Xscores - 1)

predicted.x

array containing matrices of cross-validated predictions for x(landmarks arrays will be vectorized using vecx)

predicted.y

array containing matrices of cross-validated predictions for y (landmarks arrays will be vectorized using vecx)

rv

RV-coefficient

p.value.RV

p-value for RV-coefficient determined by permutation testing

Author(s)

Stefan Schlager

References

Rohlf FJ, Corti M. 2000. Use of two-block partial least-squares to study covariation in shape. Systematic Biology 49:740-753.

See Also

plsCoVar, getPLSfromScores, predictPLSfromScores, getPLSscores, predictPLSfromData,svd , plsCoVarCommonShape, getPLSCommonShape

Examples


if (require(shapes)) {
### very arbitrary test:
### check if first 4 landmarks covaries with the second 4
proc <- procSym(gorf.dat)
## we do only 50 rounds to minimize computation time
## Not run: #same.config takes too long for CRAN check
pls1 <- pls2B(proc$rotated[1:4,,],proc$rotated[5:8,,],
              same.config=TRUE,rounds=50,mc.cores=2)

## End(Not run)
pls1 <- pls2B(proc$rotated[1:4,,],proc$rotated[5:8,,],
              same.config=FALSE,rounds=50,mc.cores=1)
pls1
layout(matrix(1:4,2,2,byrow=TRUE))
for(i in 1:4)
 plot(pls1$Xscores[,i]~pls1$Yscores[,i])


## predict first 4 landmarks from second 4 for first config
layout(1)
predPLS <- predictPLSfromData(pls1,y=proc$rotated[5:8,,1])
## show differences between prediction and original
deformGrid2d(predPLS,proc$rotated[1:4,,1],pch=19)
##plot the complete first config
points(proc$rotated[,,1])

##show effects of first latent variable
plsEffects <- plsCoVar(pls1,i=1)
deformGrid2d(plsEffects$x[,,1],plsEffects$x[,,2])##show on x
deformGrid2d(plsEffects$y[,,1],plsEffects$y[,,2],add=TRUE,pch=19)##show on y

##show effects of 2nd latent variable
plsEffects2 <- plsCoVar(pls1,i=2)
deformGrid2d(plsEffects2$x[,,1],plsEffects2$x[,,2])##show on x
deformGrid2d(plsEffects2$y[,,1],plsEffects2$y[,,2],add=TRUE,pch=19)##show on y
}

Morpho documentation built on June 22, 2024, 7:19 p.m.