d.spls.lasso | R Documentation |
The function d.spls.lasso
performs dimensional reduction as in the PLS1 methodology combined with variable selection via the
Dual-SPLS algorithm with the norm
\Omega(w)=\lambda \|w\|_1 + \|w\|_2.
d.spls.lasso(X,y,ncp,ppnu,verbose=TRUE)
X |
a numeric matrix of predictors values of dimension |
y |
a numeric vector or a one column matrix of responses. It represents the response variable for each observation. |
ncp |
a positive integer. |
ppnu |
a positive real value, in |
verbose |
a Boolean value indicating whether or not to display the iterations steps. Default value is |
The resulting solution for w
and hence for the coefficients vector, in the case of d.spls.lasso
, has
a simple closed form expression (ref) deriving from the fact that w
is collinear to a vector z_{\nu}
of coordinates
z_{\nu_j}=\textrm{sign}({z_j})(|z_j|-\nu)_+.
Here \nu
is the threshold for which ppnu
of
the absolute values of the coordinates of z=X^Ty
are greater than \nu
.
A list
of the following attributes
Xmean |
the mean vector of the predictors matrix |
scores |
the matrix of dimension |
loadings |
the matrix of dimension |
Bhat |
the matrix of dimension |
intercept |
the vector of intercept values for each component. |
fitted.values |
the matrix of dimension |
residuals |
the matrix of dimension |
lambda |
the vector of length |
zerovar |
the vector of length |
ind_diff0 |
the list of |
type |
a character specifying the Dual-SPLS norm used. In this case it is |
Louna Alsouki François Wahl
### load dual.spls library
library(dual.spls)
### constructing the simulated example
oldpar <- par(no.readonly = TRUE)
n <- 100
p <- 50
nondes <- 20
sigmaondes <- 0.5
data=d.spls.simulate(n=n,p=p,nondes=nondes,sigmaondes=sigmaondes)
X <- data$X
y <- data$y
#fitting the model
mod.dspls <- d.spls.lasso(X=X,y=y,ncp=10,ppnu=0.9,verbose=TRUE)
str(mod.dspls)
### plotting the observed values VS predicted values for 6 components
plot(y,mod.dspls$fitted.values[,6], xlab="Observed values", ylab="Predicted values",
main="Observed VS Predicted for 6 components")
points(-1000:1000,-1000:1000,type='l')
### plotting the regression coefficients
par(mfrow=c(3,1))
i=6
nz=mod.dspls$zerovar[i]
plot(1:dim(X)[2],mod.dspls$Bhat[,i],type='l',
main=paste(" Dual-SPLS (lasso), ncp =", i, " #0coef =", nz, "/", dim(X)[2]),
ylab='',xlab='' )
inonz=which(mod.dspls$Bhat[,i]!=0)
points(inonz,mod.dspls$Bhat[inonz,i],col='red',pch=19,cex=0.5)
legend("topright", legend ="non null values", bty = "n", cex = 0.8, col = "red",pch=19)
par(oldpar)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.