set.seed(1)
n <- 200
p <- 100
K <- 4
s <- 5
s0 <- 2
x_list <- lapply(1:K, function(x) matrix(rnorm(n*p, 0, 1), nrow = n))
vec <- rep(0, K * p)
non_sparse_groups <- sample(1:p, size = s, replace = FALSE)
for (group in non_sparse_groups) {
group_indices <- seq(group, K * p, by = p)
non_zero_indices <- sample(group_indices, size = s0, replace = FALSE)
vec[non_zero_indices] <- rep(2, s0)
}
y_list <- lapply(1:K, function(i) return(
y = x_list[[i]] %*% vec[((i-1)*p+1):(i*p)]+rnorm(n, 0, 0.5))
)
fit <- ADSIHT.ML(x_list, y_list)
fit$A_out[, which.min(fit$ic)]
Run the code above in your browser using DataLab