## EXAMPLE 1 ######################################
data(olitos)
grind <- which(colnames(olitos)=="grp")
set.seed(5008642)
mod <- SosDiscRobust(grp~., data=olitos, lambda=0.3, maxIte=30, Q=3, tol=1e-2)
pred <- predict(mod, newdata=olitos[,-grind])
summary(mod)
plot(mod, ind=c(1:3))
## EXAMPLE 2 ######################################
##
if (FALSE) {
library(sparseLDA)
data(penicilliumYES)
## for demonstration only:
set.seed(5008642)
X <- penicilliumYES$X[, sample(1:ncol(penicilliumYES$X), 100)]
## takes a subsample of the variables
## to have quicker computation time
colnames(X) <- paste0("V",1:ncol(X))
y <- as.factor(c(rep(1,12), rep(2,12), rep(3,12)))
set.seed(5008642)
mod <- SosDiscRobust(X, y, lambda=1, maxit=5, Q=2, tol=1e-2)
summary(mod)
plot(mod)
}
Run the code above in your browser using DataLab