R version 4.5.0 RC (2025-04-04 r88126 ucrt) -- "How About a Twenty-Six" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # testthat.R - Test suite for GICHighDimension package > > library(testthat) > library(MASS) > library(GICHighDimension) > > # Safe check for Julia availability > setup_julia_for_tests <- function() { + tryCatch({ + if (!JuliaCall::julia_exists("Base.sqrt")) { + testthat::skip("Julia not initialized. Skipping test.") + } + TRUE + }, error = function(e) { + testthat::skip(paste("Julia not available or failed:", e$message)) + }) + } > > # Test: Univariate Normal Model Selection > test_that("Univariate Normal Model Selection works correctly", { + skip_on_cran() + if (!setup_julia_for_tests()) return() + + set.seed(123) + N <- 1000L + P <- 50L + k <- 3L + true_columns <- sort(sample(1:P, k, replace = FALSE)) + + X <- matrix(rnorm(N * P), N, P) + true_beta <- numeric(P) + true_beta[true_columns] <- 2 + Y <- LP_to_Y(X, true_beta, family = "Normal", std = 1.0) + + result <- GICSelection( + X = X, + Y = Y, + Initial_Column = 1:P, + Calculate_GIC = "Calculate_SIC", + Calculate_GIC_short = "Calculate_SIC_short", + Nsim = 2L + ) + + selected_cols <- result$selected_coeffs[[length(result$selected_coeffs)]] + false_positives <- setdiff(selected_cols, true_columns) + false_negatives <- setdiff(true_columns, selected_cols) + + expect_true(length(false_positives) <= 5, info = "Too many false positives") + expect_true(length(false_negatives) <= 5, info = "Too many false negatives") + }) ── Skip: Univariate Normal Model Selection works correctly ───────────────────── Reason: Julia not available or failed: Error happens when you try to execute command ENV["R_HOME"] = "D:/RCompile/recent/R";Base.include(Main,"D:/RCompile/CRANpkg/lib/4.5/JuliaCall/julia/setup.jl") in Julia. To have more helpful error messages, you could considering running the command in Julia directly > > # Test: Univariate Poisson Model Selection > test_that("Univariate Poisson Model Selection works correctly", { + skip_on_cran() + if (!setup_julia_for_tests()) return() + + set.seed(123) + N <- 1000L + P <- 50L + k <- 3L + true_columns <- sort(sample(1:P, k, replace = FALSE)) + + X <- matrix(rnorm(N * P), N, P) + true_beta <- numeric(P) + true_beta[true_columns] <- 0.3 + Y <- LP_to_Y(X, true_beta, family = "Poisson") + + result <- GICSelection( + X = X, + Y = Y_to_LP(Y, "Poisson"), + Initial_Column = 1:P, + Calculate_GIC = "Calculate_SIC", + Calculate_GIC_short = "Calculate_SIC_short", + Nsim = 2L + ) + + selected_cols <- result$selected_coeffs[[length(result$selected_coeffs)]] + false_positives <- setdiff(selected_cols, true_columns) + false_negatives <- setdiff(true_columns, selected_cols) + + expect_true(length(false_positives) <= 5, info = "Too many false positives") + expect_true(length(false_negatives) <= 5, info = "Too many false negatives") + }) WARNING: replacing module JuliaCall. ── Skip: Univariate Poisson Model Selection works correctly ──────────────────── Reason: Julia not available or failed: Error happens when you try to execute command ENV["R_HOME"] = "D:/RCompile/recent/R";Base.include(Main,"D:/RCompile/CRANpkg/lib/4.5/JuliaCall/julia/setup.jl") in Julia. To have more helpful error messages, you could considering running the command in Julia directly > > # Test: Multivariate Normal Model Selection > test_that("Multivariate Normal Model Selection works correctly", { + skip_on_cran() + if (!setup_julia_for_tests()) return() + + set.seed(123) + N <- 3000L + P <- 200L + k <- 4L + m <- 3L + + X <- matrix(rnorm(N * P), N, P) + multi_beta <- matrix(0, P, m) + true_columns <- integer(0) + + for (i in 1:m) { + cols <- sort(sample(1:P, k, replace = FALSE)) + true_columns <- union(true_columns, cols) + multi_beta[cols, i] <- seq(1, 0.1, length.out = k) + } + + rho <- 0.2 + cov_p <- matrix(rho, m, m) + diag(cov_p) <- 1.0 + + Y <- LP_to_Y(X, multi_beta, family = "MultivariateNormal", cov_matrix = cov_p) + + result <- GICSelection( + X = X, + Y = Y, + Initial_Column = 1:P, + Calculate_GIC = "Calculate_SIC", + Calculate_GIC_short = "Calculate_SIC_short", + Nsim = 2L + ) + + selected_cols <- result$selected_coeffs[[length(result$selected_coeffs)]] + false_positives <- setdiff(selected_cols, true_columns) + false_negatives <- setdiff(true_columns, selected_cols) + + expect_true(length(false_positives) <= 5, info = "Too many false positives") + expect_true(length(false_negatives) <= 5, info = "Too many false negatives") + }) WARNING: replacing module JuliaCall. ── Skip: Multivariate Normal Model Selection works correctly ─────────────────── Reason: Julia not available or failed: Error happens when you try to execute command ENV["R_HOME"] = "D:/RCompile/recent/R";Base.include(Main,"D:/RCompile/CRANpkg/lib/4.5/JuliaCall/julia/setup.jl") in Julia. To have more helpful error messages, you could considering running the command in Julia directly > > proc.time() user system elapsed 8.31 1.71 35.39 Julia exit. LoadError("D:\\RCompile\\CRANpkg\\lib\\4.5\\JuliaCall\\julia\\setup.jl", 16, LoadError("D:\\RCompile\\CRANpkg\\lib\\4.5\\JuliaCall\\julia\\display\\RmdJulia.jl", 6, ErrorException("could not load symbol \"SET_SYMVALUE\":\nXU\xff;\xad")))LoadError("D:\\RCompile\\CRANpkg\\lib\\4.5\\JuliaCall\\julia\\setup.jl", 16, LoadError("D:\\RCompile\\CRANpkg\\lib\\4.5\\JuliaCall\\julia\\display\\RmdJulia.jl", 6, ErrorException("could not load symbol \"SET_SYMVALUE\":\nX\x7f\xff;\xad")))LoadError("D:\\RCompile\\CRANpkg\\lib\\4.5\\JuliaCall\\julia\\setup.jl", 16, LoadError("D:\\RCompile\\CRANpkg\\lib\\4.5\\JuliaCall\\julia\\display\\RmdJulia.jl", 6, ErrorException("could not load symbol \"SET_SYMVALUE\":\nX\x7f\xff;\xad")))Julia exit. Julia exit.