Skip to content

Commit

Permalink
Fix for Issue #172
Browse files Browse the repository at this point in the history
  • Loading branch information
Max-Bladen committed Mar 8, 2022
1 parent 8fc6d96 commit 41d0b84
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions R/perf.R
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,10 @@ perf.mixo_plsda <- function(object,
nrepeat = 1
}

if (nrepeat < 3 && validation != "loo") {
warning("Values in '$choice.ncomp' will reflect component count with the minimum error rate rather than the best based on a one-way t.test")
}

if (!is.logical(progressBar))
stop("'progressBar' must be either TRUE or FALSE")

Expand All @@ -806,6 +810,8 @@ perf.mixo_plsda <- function(object,
#fold is checked in 'MCVfold'




#-- check significance threshold
signif.threshold <- .check_alpha(signif.threshold)

Expand Down Expand Up @@ -997,15 +1003,24 @@ perf.mixo_plsda <- function(object,
# calculating the number of optimal component based on t.tests and the error.rate.all, if more than 3 error.rates(repeat>3)
ncomp_opt = matrix(NA, nrow = length(measure), ncol = length(dist),
dimnames = list(measure, dist))
if(nrepeat > 2 & ncomp >1)

for (measure_i in measure)
{
for (measure_i in measure)
{
for (ijk in dist)
for (ijk in dist) {
if(nrepeat > 2 & ncomp >1)
{
ncomp_opt[measure, ijk] = t.test.process(t(mat.error.rate[[measure_i]][[ijk]]), alpha = signif.threshold)
}
else
{
ncomp_opt[measure, ijk] = which(t(rowMeans(mat.error.rate[[measure_i]][[ijk]])) == min(t(rowMeans(mat.error.rate[[measure_i]][[ijk]]))))
}
}
}




result = list(error.rate = mat.mean.error,
error.rate.sd = mat.sd.error,
error.rate.all = mat.error.rate,
Expand Down

0 comments on commit 41d0b84

Please sign in to comment.