tests/testthat/test-continuum.R

test_that("Main JICO Algorithm", {
  set.seed(76)
  X1 = MASS::mvrnorm(10, rep(0, 50), diag(50)) # covariates of the first group
  X2 = MASS::mvrnorm(10, rep(0, 50), diag(50)) # covariates of the second group
  X.list = list(X1, X2)
  
  Y1 = matrix(rnorm(10)) # responses for the first group
  Y2 = matrix(rnorm(10)) # responses for the second group
  Y.list = list(Y1, Y2)
  
  ml.JICO = continuum.multigroup.iter(
    X.list, Y.list, gam=1e10, rankJ=1, rankA=c(1, 1), 
    maxiter = 300
  )
  
  expect_type(ml.JICO, "list")
})

test_that("Cross Validation", {
  set.seed(76)
  X1 = MASS::mvrnorm(10, rep(0, 50), diag(50)) # covariates of the first group
  X2 = MASS::mvrnorm(10, rep(0, 50), diag(50)) # covariates of the second group
  X.list = list(X1, X2)
  
  Y1 = matrix(rnorm(10)) # responses for the first group
  Y2 = matrix(rnorm(10)) # responses for the second group
  Y.list = list(Y1, Y2)
  
  cv.parameter.set = parameter.set.G_2(
    maxrankA = 1, maxrankJ = 1, gamma = 1e10
  ) # enumerate the set of tuning parameters
  
  cv.ml.JICO = cv.continnum.iter(
    X.list, Y.list, parameter.set = cv.parameter.set, 
    criteria = "min", nfold = 5, maxiter = 300
  )
  
  expect_type(cv.ml.JICO, "list")
})

Try the JICO package in your browser

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

JICO documentation built on May 31, 2023, 6:34 p.m.