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

Add tags and tidy code and text.

parent c797f67a
No related branches found
No related tags found
No related merge requests found
#' 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 tau A vector
#' @param Z A list of matrices. #' @param Z A list of matrices.
#' @param covariance_link String specifing the covariance link function: identity, inverse, expm. #' @param covariance_link String specifing the covariance link function:
#' @param sparse Logical force to use sparse matrix representation 'dsCMatrix'. #' identity, inverse, expm.
#' @return A list with the \eqn{\Omega} matrix its inverse and derivatives with respect to \eqn{\tau}. #' @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) { mc_build_omega <- function(tau, Z, covariance_link, sparse = FALSE) {
if (covariance_link == "identity") { if (covariance_link == "identity") {
...@@ -16,8 +21,10 @@ mc_build_omega <- function(tau, Z, covariance_link, sparse = FALSE) { ...@@ -16,8 +21,10 @@ mc_build_omega <- function(tau, Z, covariance_link, sparse = FALSE) {
if (covariance_link == "expm") { if (covariance_link == "expm") {
U <- mc_matrix_linear_predictor(tau = tau, Z = Z) U <- mc_matrix_linear_predictor(tau = tau, Z = Z)
temp <- mc_expm(U = U, inverse = FALSE, sparse = sparse) 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) D_Omega <- lapply(Z, mc_derivative_expm, UU = temp$UU,
output <- list(Omega = forceSymmetric(temp$Omega), D_Omega = D_Omega) inv_UU = temp$inv_UU, Q = temp$Q, sparse = sparse)
output <- list(Omega = forceSymmetric(temp$Omega),
D_Omega = D_Omega)
} }
if (covariance_link == "inverse") { if (covariance_link == "inverse") {
inv_Omega <- mc_matrix_linear_predictor(tau = tau, Z = Z) inv_Omega <- mc_matrix_linear_predictor(tau = tau, Z = Z)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment