Skip to contents

R6 class for normal-block model with unknown Q (number of groups)

R6 class for normal-block model with unknown Q (number of groups)

Public fields

models

list of NB_fixed_Q models corresponding to each nb_block value

control

store the list of user-defined model settings and optimization parameters

Active bindings

Q_list

number of blocks

criteria

a data frame with the values of some criteria ((approximated) log-likelihood, BIC, ICL) for the collection of models

who_am_I

a method to print what model is being fitted

Methods


Method new()

Create a new [`NB_unknown_Q`] object.

Usage

NB_unknown_Q$new(
  mydata,
  Q_list,
  zero_inflation = FALSE,
  sparsity = 0,
  control = NB_control()
)

Arguments

mydata

object of NBData class, with responses and design matrix

Q_list

list of Q values (number of groups) in the collection

zero_inflation

whether the models in the collection should be zero-inflated or not

sparsity

sparsity penalty on the network density

control

structured list of more specific parameters, to generate with NB_control

Returns

A new [`NB_unknown_Q`] object


Method optimize()

optimizes an NB_fixed_Q object for each value of Q

Usage

NB_unknown_Q$optimize(
  control = list(niter = 100, threshold = 1e-04, verbose = TRUE)
)

Arguments

control

optimization parameters (niter and threshold)


Method get_model()

returns the NB_fixed_Q model corresponding to given Q

Usage

NB_unknown_Q$get_model(Q)

Arguments

Q

number of blocks asked by user

Returns

A NB_fixed_Q object with given value Q


Method get_best_model()

Extract best model in the collection

Usage

NB_unknown_Q$get_best_model(crit = c("ICL", "BIC"))

Arguments

crit

a character for the criterion used to performed the selection. Either "ICL" or "BIC". "ICL" is the default criterion

Returns

a [`NB_fixed_Q`] object


Method plot()

Display various outputs (goodness-of-fit criteria, robustness, diagnostic) associated with a collection of network fits (a [`Networkfamily`])

Usage

NB_unknown_Q$plot(criteria = c("deviance", "ICL", "BIC", "EBIC"))

Arguments

criteria

vector of characters. The criteria to plot in `c("deviance", "BIC", "ICL")`. Defaults to all of them.

Returns

a [`ggplot2::ggplot`] graph


Method clone()

The objects of this class are cloneable with this method.

Usage

NB_unknown_Q$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.