Skip to content

Commit

Permalink
fix for #7: inv link function was not correctly applied
Browse files Browse the repository at this point in the history
  • Loading branch information
jchiquet committed Mar 17, 2021
1 parent aa6e958 commit 66be41e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions R/R6Class-BipartiteSBM.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,15 @@ BipartiteSBM <-
!is.null(private$theta$mean))
stopifnot(is.list(covarList), self$nbCovariates == length(covarList))

mu <- private$Z[[1]] %*% ( ((1-theta_p0)>0.5 ) * private$theta$mean ) %*% t(private$Z[[2]])
mu <- ((1-theta_p0)>0.5 ) * private$theta$mean
if (length(covarList) > 0) {
stopifnot(all(sapply(covarList, nrow) == self$nbNodes[1]),
all(sapply(covarList, ncol) == self$nbNodes[2]))
mu <- private$invlink[[1L]](private$link[[1L]](mu) + self$covarEffect)
res <- private$invlink[[1L]](private$Z[[1]] %*% private$link[[1L]]( mu ) %*% t(private$Z[[2]]) + self$covarEffect)
} else {
res <- private$Z[[1]] %*% mu %*% t(private$Z[[2]])
}
mu
res
},
#' @description show method
#' @param type character used to specify the type of SBM
Expand Down

0 comments on commit 66be41e

Please sign in to comment.