Description Usage Arguments Details Value Author(s) Examples
Performs a weighted Partial Least Square gaussian regression.
1 |
Y |
a vector of length |
X |
a data matrix ( |
W |
weight matrix, if |
ncomp |
a positive integer. |
This function performs a weighted PLS gaussian regression. It takes as input a vector of response, a data matrix about genes, a number of component and a weight matrix. If weight matrix is the identity matrix then it performs a standard PLS regression.
coefficients |
an array of regression coefficients ( |
projection |
the projection matrix, used to convert |
scores |
the scores matrix |
intercept |
the constant of the model. |
Caroline Bazzoli, Thomas Bouleau, Sophie Lambert-Lacroix
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 | #X simulation
meanX<-sample(1:300,50)
sdeX<-sample(50:150,50)
X<-matrix(nrow=60,ncol=50)
for (i in 1:50){
X[,i]<-rnorm(60,meanX[i],sdeX[i])
}
#Y simulation
Y<-rnorm(60,30,10)
# Learning sample
index<-sample(1:length(Y),round(2*length(Y)/3))
XL<-X[index,]
YL<-Y[index]
#fit the model
fit<-pls(Y=YL,X=XL,ncomp=3)
#Testing sample
newX=X[-index,]
#predictions with the constant of the model
a.coefficients<-rbind(fit$intercept,fit$coefficients)
#predictions
newY=cbind(rep(1,dim(newX)[1]),newX)%*%a.coefficients
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.