Skip to content

Commit

Permalink
regenerating doc
Browse files Browse the repository at this point in the history
  • Loading branch information
jchiquet committed Feb 13, 2024
1 parent e5bfded commit d7aec33
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 15 deletions.
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ S3method(plot,PLNPCAfit)
S3method(plot,PLNfamily)
S3method(plot,PLNmixturefamily)
S3method(plot,PLNmixturefit)
S3method(plot,PLNnetworkfamily)
S3method(plot,PLNnetworkfit)
S3method(plot,ZIPLNfit_sparse)
S3method(plot,ZIPLNnetworkfamily)
S3method(predict,PLNLDAfit)
S3method(predict,PLNfit)
S3method(predict,PLNmixturefit)
Expand Down
14 changes: 10 additions & 4 deletions R/PLNnetworkfamily-S3methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
## Auxiliary functions to check the given class of an objet
isPLNnetworkfamily <- function(Robject) {inherits(Robject, "Networkfamily")}

#' Display various outputs (goodness-of-fit criteria, robustness, diagnostic) associated with a collection of PLNnetwork fits (a [`PLNnetworkfamily`])
#' Display various outputs (goodness-of-fit criteria, robustness, diagnostic) associated with a collection of network fits (either [`PLNnetworkfamily`] or [`ZIPLNnetworkfamily`])
#'
#' @inheritParams plot.PLNfamily
#' @inherit plot.PLNfamily return details
Expand All @@ -20,7 +20,6 @@ isPLNnetworkfamily <- function(Robject) {inherits(Robject, "Networkfamily")}
#' @param log.x logical: should the x-axis be represented in log-scale? Default is `TRUE`.
#' @param stability scalar: the targeted level of stability in stability plot. Default is .9.
#'
#'
#' @examples
#' data(trichoptera)
#' trichoptera <- prepare_data(trichoptera$Abundance, trichoptera$Covariate)
Expand All @@ -32,8 +31,7 @@ isPLNnetworkfamily <- function(Robject) {inherits(Robject, "Networkfamily")}
#' (with \code{type = 'stability'}) or the evolution of the criteria of the different models considered
#' (with \code{type = 'criteria'}, the default).
#' @export
plot.Networkfamily <-
function(x,
plot.Networkfamily <- function(x,
type = c("criteria", "stability", "diagnostic"),
criteria = c("loglik", "pen_loglik", "BIC", "EBIC"),
reverse = FALSE,
Expand All @@ -51,6 +49,14 @@ plot.Networkfamily <-
p
}

#' @describeIn plot.Networkfamily Display various outputs associated with a collection of network fits
#' @export
plot.PLNnetworkfamily <- plot.Networkfamily

#' @describeIn plot.Networkfamily Display various outputs associated with a collection of network fits
#' @export
plot.ZIPLNnetworkfamily <- plot.Networkfamily

#' @describeIn getModel Model extraction for [`PLNnetworkfamily`]
#' @export
getModel.Networkfamily <- function(Robject, var, index = NULL) {
Expand Down
17 changes: 9 additions & 8 deletions R/PLNnetworkfamily-class.R
Original file line number Diff line number Diff line change
Expand Up @@ -494,14 +494,15 @@ ZIPLNnetworkfamily <- R6Class(
control$trace <- 0
control$config_optim$trace <- 0

myPLN <- PLNnetworkfamily$new(penalties = self$penalties,
responses = self$responses [subsample, , drop = FALSE],
covariates = self$covariates[subsample, , drop = FALSE],
offsets = self$offsets [subsample, , drop = FALSE],
formula = private$formula,
weights = self$weights [subsample], control = control)

myPLN$optimize(control$config_optim)
data <- list(
Y = self$responses [subsample, , drop = FALSE],
X = self$covariates[subsample, , drop = FALSE],
O = self$offsets [subsample, , drop = FALSE],
w = self$weights [subsample], formula = private$formula)

myPLN <- ZIPLNnetworkfamily$new(self$penalties, data, control)
myPLN$optimize(data, control$config_optim)

nets <- do.call(cbind, lapply(myPLN$models, function(model) {
as.matrix(model$latent_network("support"))[upper.tri(diag(private$p))]
}))
Expand Down
2 changes: 1 addition & 1 deletion R/ZIPLNfit-class.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ ZIPLNfit <- R6Class(
private$X0 <- data$X0
## initialize the covariance model
private$covariance <- control$covariance
private$ziparam <- control$ziparam
private$ziparam <- control$ziparam

if (isZIPLNfit(control$inception)) {
private$R <- control$inception$var_par$R
Expand Down
33 changes: 31 additions & 2 deletions man/plot.Networkfamily.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d7aec33

Please sign in to comment.