tests/testthat/test-tune.mint.splsda.R

context("tune.mint.splsda")

test_that("tune.mint.splsda works", code = {
    data(stemcells)
    data = stemcells$gene
    type.id = stemcells$celltype
    exp = stemcells$study
    
    out = tune.mint.splsda(
        X = data,
        Y = type.id,
        ncomp = 2,
        near.zero.var = FALSE,
        study = exp,
        test.keepX = seq(1, 5, 2)
    )
    
    out$choice.ncomp
    out$choice.keepX
    expect_is(out, "tune.mint.splsda")
    expect_equal(out$choice.ncomp$ncomp, 1)
    
})

test_that("tune.mint.splsda works with custom alpha", code = {
    data(stemcells)
    data = stemcells$gene
    type.id = stemcells$celltype
    exp = stemcells$study
    
    out = tune.mint.splsda(
        X = data,
        Y = type.id,
        ncomp = 2,
        near.zero.var = FALSE,
        study = exp,
        test.keepX = seq(1, 5, 2),
        signif.threshold = 0.05
    )
    
    out$choice.ncomp
    out$choice.keepX
    expect_is(out, "tune.mint.splsda")
    expect_equal(out$choice.ncomp$ncomp, 1)
    
})

Try the mixOmics package in your browser

Any scripts or data that you put into this service are public.

mixOmics documentation built on April 15, 2021, 6:01 p.m.