n <- 50 ; p <- 8
Xtrain <- matrix(rnorm(n * p), ncol = p)
colnames(Xtrain) <- paste0("V",1:p)
ytrain <- sample(c(1, 4, 10), size = n, replace = TRUE)
Xtest <- Xtrain[1:5, ] ; ytest <- ytrain[1:5]
Xtrainlist <- list(Xtrain[,1:3], Xtrain[,4:8])
Xtestlist <- list(Xtest[,1:3], Xtest[,4:8])
nlv <- 5
resnlvtestmbplsrda <- mbplsr_mbplsda_allsteps(Xlist = Xtrainlist,
Xnames = NULL, Xscaling = c("none","pareto","sd")[1],
Y = ytrain, Yscaling = "none", weights = NULL,
newXlist = Xtestlist, newXnames = NULL,
method = c("mbplsr", "mbplsrda","mbplslda","mbplsqda")[2],
prior = c("unif", "prop")[1],
step = c("nlvtest","permutation","model","prediction")[1],
nlv = 5,
modeloutput = c("scores","loadings","coef","vip"),
cvmethod = c("kfolds","loo")[2],
nbrep = 1,
seed = 123,
samplingk = NULL,
nfolds = 10,
npermut = 5,
criterion = c("err","rmse")[1],
selection = c("localmin","globalmin","1std")[1],
outputfilename = NULL)
respermutationmbplsrda <- mbplsr_mbplsda_allsteps(Xlist = Xtrainlist,
Xnames = NULL, Xscaling = c("none","pareto","sd")[1],
Y = ytrain, Yscaling = "none", weights = NULL,
newXlist = Xtestlist, newXnames = NULL,
method = c("mbplsr", "mbplsrda","mbplslda","mbplsqda")[2],
prior = c("unif", "prop")[1],
step = c("nlvtest","permutation","model","prediction")[2],
nlv = 1,
modeloutput = c("scores","loadings","coef","vip"),
cvmethod = c("kfolds","loo")[2],
nbrep = 1,
seed = 123,
samplingk = NULL,
nfolds = 10,
npermut = 5,
criterion = c("err","rmse")[1],
selection = c("localmin","globalmin","1std")[1],
outputfilename = NULL)
plotxy(respermutationmbplsrda, pch=16)
abline (h = respermutationmbplsrda[respermutationmbplsrda[,"permut_dyssimilarity"]==0,"res_permut"])
resmodelmbplsrda <- mbplsr_mbplsda_allsteps(Xlist = Xtrainlist,
Xnames = NULL, Xscaling = c("none","pareto","sd")[1],
Y = ytrain, Yscaling = "none", weights = NULL,
newXlist = Xtestlist, newXnames = NULL,
method = c("mbplsr", "mbplsrda","mbplslda","mbplsqda")[2],
prior = c("unif", "prop")[1],
step = c("nlvtest","permutation","model","prediction")[3],
nlv = 1,
modeloutput = c("scores","loadings","coef","vip"),
cvmethod = c("kfolds","loo")[2],
nbrep = 1,
seed = 123,
samplingk = NULL,
nfolds = 10,
npermut = 5,
criterion = c("err","rmse")[1],
selection = c("localmin","globalmin","1std")[1],
outputfilename = NULL)
resmodelmbplsrda$scores
resmodelmbplsrda$loadings
resmodelmbplsrda$coef
resmodelmbplsrda$vip
respredictionmbplsrda <- mbplsr_mbplsda_allsteps(Xlist = Xtrainlist,
Xnames = NULL, Xscaling = c("none","pareto","sd")[1],
Y = ytrain, Yscaling = "none", weights = NULL,
newXlist = Xtestlist, newXnames = NULL,
method = c("mbplsr", "mbplsrda","mbplslda","mbplsqda")[2],
prior = c("unif", "prop")[1],
step = c("nlvtest","permutation","model","prediction")[4],
nlv = 1,
modeloutput = c("scores","loadings","coef","vip"),
cvmethod = c("kfolds","loo")[2],
nbrep = 1,
seed = 123,
samplingk = NULL,
nfolds = 10,
npermut = 5,
criterion = c("err","rmse")[1],
selection = c("localmin","globalmin","1std")[1],
outputfilename = NULL)
Run the code above in your browser using DataLab