test_that("double_lasso produces valid outputs and double selection active set", { set.seed(123) n_p <- 80 d <- 5 X_p <- matrix(rnorm(n_p * d), n_p, d) Y <- X_p %*% c(2, 0, 1.5, 0, -1) + rnorm(n_p) target_mean <- colMeans(matrix(rnorm(40 * d, mean = 0.4), 40, d)) fit <- double_lasso(Y, X_p, target_mean, lambda = 0.05, delta = 0.05) expect_true(is.numeric(fit$estimate)) expect_false(is.na(fit$estimate)) expect_false(is.nan(fit$estimate)) expect_equal(length(fit$beta_aug), d) # Check active set double selection property (Proposition 5.3) expect_true(all(fit$active_outcome %in% fit$active_union)) expect_true(all(fit$active_balance %in% fit$active_union)) })