From 624f07e25a754add79ee231b29a4ffb9b5b6db28 Mon Sep 17 00:00:00 2001 From: Waldir Leoncio Date: Mon, 4 Dec 2023 06:31:27 +0100 Subject: [PATCH 1/4] Added documentation on `legacy` (#12) --- R/MADMMplasso.R | 2 ++ man/MADMMplasso.Rd | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/R/MADMMplasso.R b/R/MADMMplasso.R index 406c36e..3a66ace 100644 --- a/R/MADMMplasso.R +++ b/R/MADMMplasso.R @@ -23,6 +23,8 @@ #' @param pal TODO: fill in #' @param tol TODO: fill in #' @param cl TODO: fill in +#' @param legacy If \code{TRUE}, use the R version of the algorithm. Defaults to +#' C++. #' @return predicted values for the MADMMplasso fit #' @example inst/examples/MADMMplasso_example.R #' @export diff --git a/man/MADMMplasso.Rd b/man/MADMMplasso.Rd index 725f68c..f3481c2 100644 --- a/man/MADMMplasso.Rd +++ b/man/MADMMplasso.Rd @@ -26,7 +26,8 @@ MADMMplasso( pal = 0, gg = NULL, tol = 1e-04, - cl = 4 + cl = 4, + legacy = F ) } \arguments{ @@ -72,6 +73,9 @@ Categorical varables should be coded by 0-1 dummy variables: for a k-level varia \item{tol}{TODO: fill in} \item{cl}{TODO: fill in} + +\item{legacy}{If \code{TRUE}, use the R version of the algorithm. Defaults to +C++.} } \value{ predicted values for the MADMMplasso fit From 66b1c9e2ba79121414675185ff2497e48c175652 Mon Sep 17 00:00:00 2001 From: Waldir Leoncio Date: Mon, 4 Dec 2023 06:33:23 +0100 Subject: [PATCH 2/4] Changed `F` to `FALSE` (#12) CRAN standard requires booleans to be completely stated, i.e. `TRUE` and `FALSE` instead of `T` and `F`. The latter should be avoided, since they can cause confusion with similarly-named variables, not to mention are usually undetected by syntax highlighting. --- R/MADMMplasso.R | 2 +- man/MADMMplasso.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/MADMMplasso.R b/R/MADMMplasso.R index 3a66ace..050177f 100644 --- a/R/MADMMplasso.R +++ b/R/MADMMplasso.R @@ -28,7 +28,7 @@ #' @return predicted values for the MADMMplasso fit #' @example inst/examples/MADMMplasso_example.R #' @export -MADMMplasso <- function(X, Z, y, alpha, my_lambda = NULL, lambda_min = .001, max_it = 50000, e.abs = 1E-3, e.rel = 1E-3, maxgrid, nlambda, rho = 5, my_print = F, alph = 1.8, tree, cv = F, parallel = T, pal = 0, gg = NULL, tol = 1E-4, cl = 4,legacy=F) { +MADMMplasso <- function(X, Z, y, alpha, my_lambda = NULL, lambda_min = .001, max_it = 50000, e.abs = 1E-3, e.rel = 1E-3, maxgrid, nlambda, rho = 5, my_print = F, alph = 1.8, tree, cv = F, parallel = T, pal = 0, gg = NULL, tol = 1E-4, cl = 4, legacy = FALSE) { N <- nrow(X) p <- ncol(X) diff --git a/man/MADMMplasso.Rd b/man/MADMMplasso.Rd index f3481c2..ec3d9e3 100644 --- a/man/MADMMplasso.Rd +++ b/man/MADMMplasso.Rd @@ -27,7 +27,7 @@ MADMMplasso( gg = NULL, tol = 1e-04, cl = 4, - legacy = F + legacy = FALSE ) } \arguments{ From 11edea6d3942b87e4fc5a2dd913a8600027ddb46 Mon Sep 17 00:00:00 2001 From: Waldir Leoncio Date: Mon, 4 Dec 2023 06:35:27 +0100 Subject: [PATCH 3/4] Removed redundancy (#12) Nothing particularly wrong with using `legacy = legacy`, but if the rest of the call doesn't use it, perhaps this argument shouldn't either. --- R/MADMMplasso.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/MADMMplasso.R b/R/MADMMplasso.R index 050177f..55dd19a 100644 --- a/R/MADMMplasso.R +++ b/R/MADMMplasso.R @@ -189,7 +189,7 @@ MADMMplasso <- function(X, Z, y, alpha, my_lambda = NULL, lambda_min = .001, max admm_MADMMplasso( beta0, theta0, beta, beta_hat, theta, rho1, X, Z, max_it, my_W_hat, XtY, y, N, e.abs, e.rel, alpha, lam[i, ], alph, svd.w, tree, my_print, - invmat, cv, gg[i, ],legacy=legacy + invmat, cv, gg[i, ],legacy ) } parallel::stopCluster(cl) @@ -200,7 +200,7 @@ MADMMplasso <- function(X, Z, y, alpha, my_lambda = NULL, lambda_min = .001, max admm_MADMMplasso( beta0, theta0, beta, beta_hat, theta, rho1, X, Z, max_it, my_W_hat, XtY, y, N, e.abs, e.rel, alpha, lam[g, ], alph, svd.w, tree, my_print, - invmat, cv, gg[g, ],legacy=legacy + invmat, cv, gg[g, ],legacy ) } ) @@ -219,7 +219,7 @@ MADMMplasso <- function(X, Z, y, alpha, my_lambda = NULL, lambda_min = .001, max my_values <- admm_MADMMplasso( beta0, theta0, beta, beta_hat, theta, rho1, X, Z, max_it, my_W_hat, XtY, y, N, e.abs, e.rel, alpha, lambda, alph, svd.w, tree, my_print, invmat, - cv, gg[hh, ],legacy=legacy + cv, gg[hh, ],legacy ) beta <- my_values$beta From a82ed7299592734031c48853c1409e86046b67d2 Mon Sep 17 00:00:00 2001 From: Waldir Leoncio Date: Mon, 4 Dec 2023 06:44:13 +0100 Subject: [PATCH 4/4] Increment version number to 0.0.0.9008 --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index ee2ed87..ee1ff72 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: MADMMplasso Title: Multi Variate Multi Response 'ADMM' with Interaction Effects -Version: 0.0.0.9007 +Version: 0.0.0.9008 Authors@R: c( person(