Nothing
#' Orthogonalize factors
#' @keywords internal
#'
#'@importFrom stats lm
#'
orthogonalize_factors <- function(X) {
n_factors <- ncol(X)
X <- Re(X)
# Iterative orthogonalization
for (i in 1:n_factors) {
# Regress the i-th factor on all other factors (excluding itself)
other_factors <- X[, -i, drop = FALSE]
model <- lm(X[, i] ~ other_factors)
X[, i] <- residuals(model)
}
return(X)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.