Skip to content
Snippets Groups Projects
Commit 31c47c43 authored by Walmes Marques Zeviani's avatar Walmes Marques Zeviani
Browse files

Add tags and tidy text and code.

parent 0b65f0cf
No related branches found
No related tags found
No related merge requests found
#' Build the correlation matrix between response variables #' @title Build the correlation matrix between response variables
#' @author Wagner Hugo Bonat
#'
#' @description This function builds the correlation matrix between
#' response variable, its inverse and derivatives.
#' #'
#' @description This function builds the correlation matrix between response variable, its inverse and
#' derivatives.
#' @param rho A numeric vector. #' @param rho A numeric vector.
#' @param n_resp A numeric. #' @param n_resp A numeric.
#' @param inverse Logical #' @param inverse Logical.
#' @return A list with sigmab and its derivatives with respect to rho. #' @return A list with sigmab and its derivatives with respect to rho.
mc_build_sigma_between <- function(rho, n_resp, inverse = FALSE) { mc_build_sigma_between <- function(rho, n_resp, inverse = FALSE) {
...@@ -19,8 +21,11 @@ mc_build_sigma_between <- function(rho, n_resp, inverse = FALSE) { ...@@ -19,8 +21,11 @@ mc_build_sigma_between <- function(rho, n_resp, inverse = FALSE) {
} }
if (inverse == TRUE) { if (inverse == TRUE) {
inv_Sigmab <- solve(Sigmab) inv_Sigmab <- solve(Sigmab)
D_inv_Sigmab <- lapply(D_Sigmab, mc_sandwich_negative, bord1 = inv_Sigmab, bord2 = inv_Sigmab) D_inv_Sigmab <- lapply(D_Sigmab, mc_sandwich_negative,
output <- list(inv_Sigmab = inv_Sigmab, D_inv_Sigmab = D_inv_Sigmab) bord1 = inv_Sigmab,
bord2 = inv_Sigmab)
output <- list(inv_Sigmab = inv_Sigmab,
D_inv_Sigmab = D_inv_Sigmab)
} }
} }
return(output) return(output)
...@@ -33,7 +38,8 @@ mc_derivative_sigma_between <- function(n_resp) { ...@@ -33,7 +38,8 @@ mc_derivative_sigma_between <- function(n_resp) {
n_par <- n_resp * (n_resp - 1)/2 n_par <- n_resp * (n_resp - 1)/2
for (i in 1:n_par) { for (i in 1:n_par) {
Derivative <- Matrix(0, ncol = n_resp, nrow = n_resp) Derivative <- Matrix(0, ncol = n_resp, nrow = n_resp)
Derivative[position[1, i], position[2, i]] <- Derivative[position[2, i], position[1, i]] <- 1 Derivative[position[1, i], position[2, i]] <-
Derivative[position[2, i], position[1, i]] <- 1
list.Derivative[i][[1]] <- Derivative list.Derivative[i][[1]] <- Derivative
} }
return(list.Derivative) return(list.Derivative)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment