| Title: | Multiomics Data Integration |
|---|---|
| Description: | Provides functions to do 'O2PLS-DA' analysis for multiple omics data integration. The algorithm came from "O2-PLS, a two-block (X±Y) latent variable regression (LVR) method with an integral OSC filter" which published by Johan Trygg and Svante Wold at 2003 <doi:10.1002/cem.775>. 'O2PLS' is a bidirectional multivariate regression method that aims to separate the covariance between two data sets (it was recently extended to multiple data sets) (Löfstedt and Trygg, 2011 <doi:10.1002/cem.1388>; Löfstedt et al., 2012 <doi:10.1016/j.aca.2013.06.026>) from the systematic sources of variance being specific for each data set separately. |
| Authors: | Kai Guo [aut, cre], Junguk Hur [aut], Eva Feldman [aut] |
| Maintainer: | Kai Guo <[email protected]> |
| License: | GPL-3 |
| Version: | 0.0.26 |
| Built: | 2026-06-08 06:52:50 UTC |
| Source: | https://github.com/cran/o2plsda |
This function extracts loading parameters from an O2PLS fit
This function extracts loading parameters from an O2PLS fit
loadings(x, ...) ## S3 method for class 'O2pls' loadings(x, loading = c("Xjoint", "Yjoint", "Xorth", "Yorth"), ...)loadings(x, ...) ## S3 method for class 'O2pls' loadings(x, loading = c("Xjoint", "Yjoint", "Xorth", "Yorth"), ...)
x |
Object of class |
... |
For consistency |
loading |
the loadings for one of "Xjoint", "Yjoint", "Xorth", "Yorth" |
Loading matrix
Loading matrix
extract the loading value from the O2PLSDA analysis
## S3 method for class 'o2plsda' loadings(x, loading = "Xloading", ...)## S3 method for class 'o2plsda' loadings(x, loading = "Xloading", ...)
x |
Object of class |
loading |
the loadings for one of "Xjoint", "Yjoint", "Xorth", "Yorth" |
... |
For consistency |
extract the loading value from the PLSDA analysis
## S3 method for class 'plsda' loadings(x, ...)## S3 method for class 'plsda' loadings(x, ...)
x |
Object of class |
... |
For consistency |
Cross validation for O2PLS
o2cv( X, Y, nc, nx, ny, group = NULL, nr_folds = 5, ncores = 1, scale = FALSE, center = FALSE )o2cv( X, Y, nc, nx, ny, group = NULL, nr_folds = 5, ncores = 1, scale = FALSE, center = FALSE )
X |
a Numeric matrix (input) |
Y |
a Numeric matrix (input) |
nc |
Integer. Number of joint PLS components. |
nx |
Integer. Number of orthogonal components in X |
ny |
Integer. Number of orthogonal components in Y |
group |
a vector to indicate the group for Y |
nr_folds |
Integer to indicate the folds for cross validation |
ncores |
Integer. Number of CPUs to use for cross validation |
scale |
boolean values determining if data should be scaled or not |
center |
boolean values determining if data should be centered or not |
a data frame with the Q and RMSE values
Kai Guo
set.seed(123) X = matrix(rnorm(500),50,10) Y = matrix(rnorm(500),50,10) X = scale(X, scale = TRUE) Y = scale(Y, scale = TRUE) # group factor could be omitted if you don't have any group group <- rep(c("Ctrl","Treat"), each = 25) cv <- o2cv(X, Y, 1:2, 1:2, 1:2, group=group, nr_folds = 2, ncores=1)set.seed(123) X = matrix(rnorm(500),50,10) Y = matrix(rnorm(500),50,10) X = scale(X, scale = TRUE) Y = scale(Y, scale = TRUE) # group factor could be omitted if you don't have any group group <- rep(c("Ctrl","Treat"), each = 25) cv <- o2cv(X, Y, 1:2, 1:2, 1:2, group=group, nr_folds = 2, ncores=1)
fit O2PLS model with best nc, nx, ny
o2pls(X, Y, nc, nx, ny, scale = FALSE, center = FALSE)o2pls(X, Y, nc, nx, ny, scale = FALSE, center = FALSE)
X |
a Numeric matrix (input) |
Y |
a Numeric matrix (input) |
nc |
Integer. Number of joint PLS components. |
nx |
Integer. Number of orthogonal components in X |
ny |
Integer. Number of orthogonal components in Y |
scale |
boolean values determining if data should be scaled or not |
center |
boolean values determining if data should be centered or not |
An object containing
Xscore |
Joint |
Xloading |
Joint |
Yscore |
Joint |
Yloading |
Joint |
TYosc |
Orthogonal |
PYosc |
Orthogonal |
WYosc |
Orthogonal |
UXosc |
Orthogonal |
PXosc |
Orthogonal |
CXosc |
Orthogonal |
BU |
Regression coefficient in |
BT |
Regression coefficient in |
Xhat |
Prediction of |
Yhat |
Prediction of |
R2Xhat |
Variation of the predicted |
R2Yhat |
Variation of the predicted |
R2X |
Variation of the modeled part in |
R2Y |
Variation of the modeled part in |
R2Xcorr |
Variation of the joint part in |
R2Ycorr |
Variation of the joint part in |
R2Xo |
Variation of the orthogonal part in |
R2Yo |
Variation of the orthogonal part in |
R2Xp |
Variation in |
R2Yp |
Variation in |
varXj |
Variation in each Latent Variable (LV) in |
varYj |
Variation in each Latent Variable (LV) in |
varXorth |
Variation in each Latent Variable (LV) in |
varYorth |
Variation in each Latent Variable (LV) in |
Exy |
Residuals in |
Fxy |
Residuals in |
Kai Guo
set.seed(123) X = matrix(rnorm(500),50,10) Y = matrix(rnorm(500),50,10) X = scale(X, scale = TRUE) Y = scale(Y, scale = TRUE) fit <- o2pls(X, Y, 1, 2, 2) summary(fit)set.seed(123) X = matrix(rnorm(500),50,10) Y = matrix(rnorm(500),50,10) X = scale(X, scale = TRUE) Y = scale(Y, scale = TRUE) fit <- o2pls(X, Y, 1, 2, 2) summary(fit)
Class "O2pls" This class represents the Annotation information
Xa Numeric matrix (input)
Ya Numeric matrix (input)
paramsparamaters ysed in o2pls analysis
resultslist of o2pls results
Kai Guo
Computes orthogonal scores partial least squares regressions with the NIPALS algorithm. It return a comprehensive set of pls outputs (e.g. scores and vip).
oplsda(X, Y, nc, scale = FALSE, center = TRUE, maxiter = 100, tol = 1e-05)oplsda(X, Y, nc, scale = FALSE, center = TRUE, maxiter = 100, tol = 1e-05)
X |
a O2pls object or a matrix of predictor variables. |
Y |
a single vector indicate the group |
nc |
the number of pls components (the one joint components + number of orthogonal components ). |
scale |
logical indicating whether |
center |
boolean values determining if data should be centered or not |
maxiter |
maximum number of iterations. |
tol |
limit for convergence of the algorithm in the nipals algorithm. |
a list containing the following elements:
nc the number of components used(one joint components +
number of orthogonal components
scores a matrix of scores corresponding to the observations
in X, The components retrieved correspond to the ones optimized
or specified.
Xloadings a matrix of loadings corresponding to the
explanatory variables. The components retrieved correspond to the ones
optimized or specified.
Yloadings a matrix of partial least squares loadings
corresponding to Y
vip the VIP matrix.
xvar a matrix indicating the standard deviation of each
component (sd), the variance explained by each single component
(explained_var) and the cumulative explained variance
(cumulative_explained_var). These values are
computed based on the data used to create the projection matrices.
projection_matrix the matrix of projection matrix
weight a matrix of partial least squares ("pls") weights.
Kai Guo
X <- matrix(rnorm(50),10,5) Y <- matrix(rnorm(50),10,5) fit <- o2pls(X,Y,2,1,1) yy <- rep(c(0,1),5) fit0 <- oplsda(fit,yy,2)X <- matrix(rnorm(50),10,5) Y <- matrix(rnorm(50),10,5) fit <- o2pls(X,Y,2,1,1) yy <- rep(c(0,1),5) fit0 <- oplsda(fit,yy,2)
Score or loading plot for the O2PLS results
## S3 method for class 'O2pls' plot( x, type = "score", var = "Xjoint", group = NULL, ind = c(1, 2), color = NULL, top = 20, ellipse = TRUE, order = FALSE, pt.size = 3, label = TRUE, label.size = 4, repel = TRUE, rotation = FALSE, ... )## S3 method for class 'O2pls' plot( x, type = "score", var = "Xjoint", group = NULL, ind = c(1, 2), color = NULL, top = 20, ellipse = TRUE, order = FALSE, pt.size = 3, label = TRUE, label.size = 4, repel = TRUE, rotation = FALSE, ... )
x |
an O2pls object |
type |
score or loading |
var |
specify Xjoint |
group |
color used for score plot |
ind |
which components to be used for score plot or loading plot |
color |
color used for score or loading plot |
top |
the number of largest loading value to plot |
ellipse |
TRUE/FALSE |
order |
order by the value or not |
pt.size |
point size |
label |
plot label or not (TRUE/FALSE) |
label.size |
label size |
repel |
use ggrepel to show the label or not |
rotation |
flip the figure or not (TRUE/FALSE) |
... |
For consistency |
a ggplot2 object
Kai Guo
X <- matrix(rnorm(50),10,5) Y <- matrix(rnorm(50),10,5) fit <- o2pls(X,Y,2,1,1) plot(fit, type="score")X <- matrix(rnorm(50),10,5) Y <- matrix(rnorm(50),10,5) fit <- o2pls(X,Y,2,1,1) plot(fit, type="score")
Score, VIP or loading plot for the O2PLS results
## S3 method for class 'o2plsda' plot( x, type = "score", group = NULL, ind = c(1, 2), color = NULL, top = 20, ellipse = TRUE, order = FALSE, pt.size = 3, label = TRUE, label.size = 4, repel = FALSE, rotation = FALSE, ... )## S3 method for class 'o2plsda' plot( x, type = "score", group = NULL, ind = c(1, 2), color = NULL, top = 20, ellipse = TRUE, order = FALSE, pt.size = 3, label = TRUE, label.size = 4, repel = FALSE, rotation = FALSE, ... )
x |
an o2plsda object |
type |
score, vip or loading |
group |
color used for score plot |
ind |
which components to be used for score plot or loading plot |
color |
color used for score or loading plot |
top |
the number of largest loading value to plot |
ellipse |
TRUE/FALSE |
order |
order by the value or not |
pt.size |
point size |
label |
plot label or not (TRUE/FALSE) |
label.size |
label size |
repel |
use ggrepel to show the label or not |
rotation |
flip the figure or not (TRUE/FALSE) |
... |
For consistency |
a ggplot2 object
Kai Guo
X <- matrix(rnorm(50),10,5) Y <- matrix(rnorm(50),10,5) fit <- o2pls(X,Y,2,1,1) yy <- rep(c(0,1),5) fit0 <- oplsda(fit,yy,2) plot(fit0, type="score", group = factor(yy))X <- matrix(rnorm(50),10,5) Y <- matrix(rnorm(50),10,5) fit <- o2pls(X,Y,2,1,1) yy <- rep(c(0,1),5) fit0 <- oplsda(fit,yy,2) plot(fit0, type="score", group = factor(yy))
Score, VIP or loading plot for the plsda results
## S3 method for class 'plsda' plot( x, type = "score", group = NULL, ind = c(1, 2), color = NULL, top = 20, ellipse = TRUE, order = FALSE, pt.size = 3, label = TRUE, label.size = 4, repel = FALSE, rotation = FALSE, ... )## S3 method for class 'plsda' plot( x, type = "score", group = NULL, ind = c(1, 2), color = NULL, top = 20, ellipse = TRUE, order = FALSE, pt.size = 3, label = TRUE, label.size = 4, repel = FALSE, rotation = FALSE, ... )
x |
an plsda object |
type |
score, vip or loading |
group |
color used for score plot |
ind |
which components to be used for score plot or loading plot |
color |
color used for score or loading plot |
top |
the number of largest loading value to plot |
ellipse |
TRUE/FALSE |
order |
order by the value or not |
pt.size |
point size |
label |
plot label or not (TRUE/FALSE) |
label.size |
label size |
repel |
use ggrepel to show the label or not |
rotation |
flip the figure or not (TRUE/FALSE) |
... |
For consistency |
a ggplot2 object
Kai Guo
X <- matrix(rnorm(500),10,50) Y <- rep(c("a","b"),each=5) fit0 <- plsda(X,Y,2) plot(fit0, type = "score", group = factor(Y))X <- matrix(rnorm(500),10,50) Y <- rep(c("a","b"),each=5) fit0 <- plsda(X,Y,2) plot(fit0, type = "score", group = factor(Y))
Perform a PLS discriminant analysis
plsda(X, Y, nc, scale = TRUE, center = TRUE, cv = TRUE, nr_folds = 5)plsda(X, Y, nc, scale = TRUE, center = TRUE, cv = TRUE, nr_folds = 5)
X |
a matrix of predictor variables. |
Y |
a single vector indicate the group |
nc |
the number of pls components (the one joint components + number of orthogonal components ). |
scale |
logical indicating whether |
center |
logical indicating whether |
cv |
logical indicating whether cross-validation will be performed or not (suggest TRUE). |
nr_folds |
nr_folds Integer to indicate the folds for cross validation. |
a list containing the following elements:
nc the number of components used(one joint components +
number of orthogonal components
scores a matrix of scores corresponding to the observations
in X, The components retrieved correspond to the ones optimized
or specified.
Xloadings a matrix of loadings corresponding to the
explanatory variables. The components retrieved correspond to the ones
optimized or specified.
vip the VIP matrix.
xvar variance explained of X by each single component.
R2Y variance explained of Y by each single component.
PRESS The residual sum of squares for the samples which were not used to fit the model
Q2 quality of cross-validation
Kai Guo
X <- matrix(rnorm(500),10,50) Y <- rep(c("a","b"),each=5) fit <- plsda(X,Y,2)X <- matrix(rnorm(500),10,50) Y <- rep(c("a","b"),each=5) fit <- plsda(X,Y,2)
Print the summary of O2PLS results.
## S3 method for class 'O2pls' print(x, ...)## S3 method for class 'O2pls' print(x, ...)
x |
An O2pls object |
... |
For consistency |
Kai Guo
X <- matrix(rnorm(50),10,5) Y <- matrix(rnorm(50),10,5) object <- o2pls(X,Y,1,1,1) print(object)X <- matrix(rnorm(50),10,5) Y <- matrix(rnorm(50),10,5) object <- o2pls(X,Y,1,1,1) print(object)
Print the summary of plsda results.
## S3 method for class 'plsda' print(x, ...)## S3 method for class 'plsda' print(x, ...)
x |
An plsda object |
... |
For consistency |
Kai Guo
X <- matrix(rnorm(500),10,50) Y <- rep(c("a","b"),each=5) fit <- plsda(X,Y,2) print(fit)X <- matrix(rnorm(500),10,50) Y <- rep(c("a","b"),each=5) fit <- plsda(X,Y,2) print(fit)
This function extracts score matrices from an O2PLS fit
scores(x, ...)scores(x, ...)
x |
Object of class |
... |
For consistency |
Scores matrix
This function extracts scores parameters from an O2PLS fit
## S3 method for class 'O2pls' scores(x, score = c("Xjoint", "Yjoint", "Xorth", "Yorth"), ...)## S3 method for class 'O2pls' scores(x, score = c("Xjoint", "Yjoint", "Xorth", "Yorth"), ...)
x |
Object of class |
score |
the scores matrix for one of "Xjoint", "Yjoint", "Xorth", "Yorth" |
... |
Other arguments |
score matrix
Extract the scores from an O2PLS DA analysis
## S3 method for class 'o2plsda' scores(x, ...)## S3 method for class 'o2plsda' scores(x, ...)
x |
Object of class |
... |
Other arguments |
score matrix
Kai Guo
Extract the scores PLSDA analysis
## S3 method for class 'plsda' scores(x, ...)## S3 method for class 'plsda' scores(x, ...)
x |
Object of class |
... |
Other arguments |
score matrix
Kai Guo
Summary of an O2PLS object
## S3 method for class 'O2pls' summary(object, ...)## S3 method for class 'O2pls' summary(object, ...)
object |
a O2pls object |
... |
For consistency |
Detail of O2PLS results
Kai Guo
X <- matrix(rnorm(50),10,5) Y <- matrix(rnorm(50),10,5) object <- o2pls(X,Y,1,1,1) summary(object)X <- matrix(rnorm(50),10,5) Y <- matrix(rnorm(50),10,5) object <- o2pls(X,Y,1,1,1) summary(object)
Summary of an plsda object
## S3 method for class 'plsda' summary(object, ...)## S3 method for class 'plsda' summary(object, ...)
object |
a plsda object |
... |
For consistency |
Detail of plsda results
Kai Guo
X <- matrix(rnorm(500),10,50) Y <- rep(c("a","b"),each=5) fit <- plsda(X,Y,2) summary(fit)X <- matrix(rnorm(500),10,50) Y <- rep(c("a","b"),each=5) fit <- plsda(X,Y,2) summary(fit)
Extract the VIP values from the O2PLS-DA object
vip(x)vip(x)
x |
the o2plsda object or plsda object |
a data frame