diff --git a/R/r2_mlm.R b/R/r2_mlm.R index e6b6c243b..0f08ad235 100644 --- a/R/r2_mlm.R +++ b/R/r2_mlm.R @@ -69,9 +69,10 @@ r2_mlm <- function(model, ...) { #' @export r2_mlm.mlm <- function(model, verbose = TRUE, ...) { - - rho2_vec <- - 1 - stats::cancor(insight::get_predictors(model), insight::get_response(model))$cor^2 + rho2_vec <- 1 - stats::cancor( + insight::get_predictors(model), + insight::get_response(model) + )$cor^2 R_xy <- 1 - Reduce(`*`, rho2_vec, 1) resid_cov <- stats::cov(residuals(model)) @@ -80,8 +81,5 @@ r2_mlm.mlm <- function(model, verbose = TRUE, ...) { V_xy <- qq - sum(diag(solve(resp_cov) %*% resid_cov)) P_xy <- V_xy / qq - c( - "Symmetric Rxy" = R_xy, - "Asymmetric Pxy" = P_xy - ) + c("Symmetric Rxy" = R_xy, "Asymmetric Pxy" = P_xy) }