R Under development (unstable) (2025-04-16 r88149 ucrt) -- "Unsuffered Consequences" 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. > stopifnot(require(hdi)) Loading required package: hdi Loading required package: scalreg Loading required package: lars Loaded lars 1.3 > > ## this is the example code of the help file of plotClusterGroupBound > > > ## Create a regression problem with correlated design (n = 10, p = 3): > ## a block of size 2 and a block of size 1, within-block correlation is 0.99 > > set.seed(29) > p <- 3 > n <- 10 > > Sigma <- diag(p) > Sigma[1,2] <- Sigma[2,1] <- 0.99 > > x <- matrix(rnorm(n * p), nrow = n) %*% chol(Sigma) > > ## Create response with active variable 1 > beta <- rep(0, p) > beta[1] <- 5 > > y <- as.numeric(x %*% beta + rnorm(n)) > > ## Compute the lower bound for all groups in a hierarchical clustering tree > cgb5 <- clusterGroupBound(x, y, nsplit = 4) ## use larger value for nsplit! 5 3 member(s) with lower bound 3.642297 3 1 member(s) with lower bound 0 4 2 member(s) with lower bound 3.057924 1 1 member(s) with lower bound 0 2 1 member(s) with lower bound 0 > > ## Plot the tree with y-axis proportional to the (log) of the number of > ## group members and node sizes proportional to the lower l1-norm bound. > plot(cgb5) > > ## Show the lower bound on the y-axis and node sizes proportional to > ## number of group members > plot(cgb5, yaxis = "") > > proc.time() user system elapsed 4.15 4.64 8.81