diff --git a/R/mc_build_omega.R b/R/mc_build_omega.R index 73ad728a4b0532668b166d293ebe1fa1bb21a946..869702000eb33e1e62ec2ebc35f5822519d5da1c 100644 --- a/R/mc_build_omega.R +++ b/R/mc_build_omega.R @@ -1,12 +1,17 @@ -#' Build omega matrix +#' @title Build omega matrix +#' @author Wagner Hugo Bonat #' -#' @description This function build \eqn{\Omega} matrix according the covariance link function. +#' @description This function build \eqn{\Omega} matrix according the +#' covariance link function. #' #' @param tau A vector #' @param Z A list of matrices. -#' @param covariance_link String specifing the covariance link function: identity, inverse, expm. -#' @param sparse Logical force to use sparse matrix representation 'dsCMatrix'. -#' @return A list with the \eqn{\Omega} matrix its inverse and derivatives with respect to \eqn{\tau}. +#' @param covariance_link String specifing the covariance link function: +#' identity, inverse, expm. +#' @param sparse Logical force to use sparse matrix representation +#' 'dsCMatrix'. +#' @return A list with the \eqn{\Omega} matrix its inverse and +#' derivatives with respect to \eqn{\tau}. mc_build_omega <- function(tau, Z, covariance_link, sparse = FALSE) { if (covariance_link == "identity") { @@ -16,8 +21,10 @@ mc_build_omega <- function(tau, Z, covariance_link, sparse = FALSE) { if (covariance_link == "expm") { U <- mc_matrix_linear_predictor(tau = tau, Z = Z) temp <- mc_expm(U = U, inverse = FALSE, sparse = sparse) - D_Omega <- lapply(Z, mc_derivative_expm, UU = temp$UU, inv_UU = temp$inv_UU, Q = temp$Q, sparse = sparse) - output <- list(Omega = forceSymmetric(temp$Omega), D_Omega = D_Omega) + D_Omega <- lapply(Z, mc_derivative_expm, UU = temp$UU, + inv_UU = temp$inv_UU, Q = temp$Q, sparse = sparse) + output <- list(Omega = forceSymmetric(temp$Omega), + D_Omega = D_Omega) } if (covariance_link == "inverse") { inv_Omega <- mc_matrix_linear_predictor(tau = tau, Z = Z)