From 2ea9ca1378acfe66f5ab4613ddf36c635dbac530 Mon Sep 17 00:00:00 2001 From: SirUnknown2 <39381986+SirUnknown2@users.noreply.github.com> Date: Sun, 4 Dec 2022 14:05:30 +0530 Subject: [PATCH 1/3] Fix full rank --- R/rrr.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/rrr.R b/R/rrr.R index d53673b..a549c90 100644 --- a/R/rrr.R +++ b/R/rrr.R @@ -45,7 +45,7 @@ rrr <- function(x, y, type = "identity", rank = "full", k = 0){ if(type == "lda"){ full_rank <- dim(distinct(as_data_frame(y)))[1] - 1 } else { - full_rank <- min(dim(x)[2], dim(y)[2]) + full_rank <- dim(y)[2] } if(rank == "full"){ reduced_rank <- full_rank From fb987f9fd381080102b7e2f97bf3523cbfc73715 Mon Sep 17 00:00:00 2001 From: SirUnknown2 <39381986+SirUnknown2@users.noreply.github.com> Date: Sun, 4 Dec 2022 14:26:45 +0530 Subject: [PATCH 2/3] Fix full rank for rank trace and residuals --- R/rrr.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/rrr.R b/R/rrr.R index a549c90..a6ce5b4 100644 --- a/R/rrr.R +++ b/R/rrr.R @@ -99,7 +99,7 @@ rrr <- function(x, y, type = "identity", rank = "full", k = 0){ #' @export rank_trace <- function(x, y, type = "identity", k = 0, plot = TRUE, interactive = FALSE){ - ident <- diag(1, min(dim(x)[2], dim(y)[2])) + ident <- diag(1, dim(y)[2]) switch(type, identity = rrr_rank_trace(x, y, ident, k, plot, interactive), cva = cva_rank_trace(x, y, k, plot, interactive), @@ -138,7 +138,7 @@ rank_trace <- function(x, y, type = "identity", k = 0, plot = TRUE, interactive #' @export residuals <- function(x, y, type = "identity", rank = "full", k = 0, plot = TRUE){ - ident <- diag(1, min(dim(x)[2], dim(y)[2])) + ident <- diag(1, dim(y)[2]) switch(type, identity = rrr_residual_plot(x, y, ident, rank, k, plot), cva = cva_residual_plot(x, y, rank, k, plot), From 95740136dcdd157bb85c340f11ef2fe2129d0168 Mon Sep 17 00:00:00 2001 From: SirUnknown2 <39381986+SirUnknown2@users.noreply.github.com> Date: Sun, 4 Dec 2022 16:28:54 +0530 Subject: [PATCH 3/3] Update reduce_rank_regression.R --- R/reduce_rank_regression.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/reduce_rank_regression.R b/R/reduce_rank_regression.R index c9c7cfd..6fbbae6 100644 --- a/R/reduce_rank_regression.R +++ b/R/reduce_rank_regression.R @@ -1,5 +1,5 @@ reduce_rank_regression <- function(x, y, gamma_matrix, rank = "full", k = 0){ - full_rank <- min(dim(x)[2], dim(y)[2]) + full_rank <- dim(y)[2] if(rank == "full"){ reduce_rank <- full_rank } else if(rank <= full_rank){