require(rgl)
## 3D variable representation for objects of class 'rcc'
data(nutrimouse)
X <- nutrimouse$lipid
Y <- nutrimouse$gene
nutri.res <- rcc(X, Y, ncomp = 3, lambda1 = 0.064, lambda2 = 0.008)
# default
plot3dVar(nutri.res)
# cutoff active, labeling the variables
plot3dVar(nutri.res, cutoff = 0.7, X.label = TRUE, cex = c(0.8, 0.8))
## 3D variable representation for objects of class 'pls' or 'spls'
data(liver.toxicity)
X <- liver.toxicity$gene
Y <- liver.toxicity$clinic
toxicity.spls.1 <- spls(X, Y, ncomp = 3, keepX = c(50, 50, 50),
keepY = c(10, 10, 10))
plot3dVar(toxicity.spls.1, rad.in = 0.5, keep.var = TRUE,
cex = c(1, 0.8), main = "Variables 3D representation")
toxicity.spls.2 <- spls(X, Y, ncomp = 3, keepX = c(10, 10, 10),
keepY = c(10, 10, 10))
plot3dVar(toxicity.spls.2, rad.in = 0.5, keep.var = TRUE,
Y.label = TRUE, main = "Variables 3D representation",
label.axes.box = "axes")
## 3D variable representation for objects of class 'pca'
data(multidrug)
pca.res <- pca(multidrug$ABC.trans, ncomp = 4, scale = TRUE)
plot3dVar(pca.res)
## variable representation for objects of class 'splsda'
data(liver.toxicity)
X = as.matrix(liver.toxicity$gene)
Y = as.factor(liver.toxicity$treatment[,4])
keepX = 20
ncomp = 3
splsda.liver = splsda(X, Y, ncomp = ncomp, keepX = c(rep(keepX, ncomp)), mode = 'regression')
plot3dVar(splsda.liver, X.label = FALSE, Y.label = TRUE, keep.var = TRUE)
Run the code above in your browser using DataLab