PLNPCAfamily: An R6 Class to represent a collection of PLNPCAfit

PLNPCAfamilyR Documentation

An R6 Class to represent a collection of PLNPCAfit

Description

The function PLNPCA() produces an instance of this class.

This class comes with a set of methods, some of them being useful for the user: See the documentation for getBestModel(), getModel() and plot().

Super class

PLNmodels::PLNfamily -> PLNPCAfamily

Active bindings

ranks

the dimensions of the successively fitted models

Methods

Public methods

Inherited methods

Method new()

Initialize all models in the collection.

Usage
PLNPCAfamily$new(
  ranks,
  responses,
  covariates,
  offsets,
  weights,
  formula,
  control
)
Arguments
ranks

the dimensions of the successively fitted models

responses

the matrix of responses common to every models

covariates

the matrix of covariates common to every models

offsets

the matrix of offsets common to every models

weights

the vector of observation weights

formula

model formula used for fitting, extracted from the formula in the upper-level call

control

list controlling the optimization and the model


Method optimize()

Call to the C++ optimizer on all models of the collection

Usage
PLNPCAfamily$optimize(config)
Arguments
config

list controlling the optimization.


Method getModel()

Extract model from collection and add "PCA" class for compatibility with factoextra::fviz()

Usage
PLNPCAfamily$getModel(var, index = NULL)
Arguments
var

value of the parameter (rank for PLNPCA, sparsity for PLNnetwork) that identifies the model to be extracted from the collection. If no exact match is found, the model with closest parameter value is returned with a warning.

index

Integer index of the model to be returned. Only the first value is taken into account.

Returns

a PLNPCAfit object


Method getBestModel()

Extract best model in the collection

Usage
PLNPCAfamily$getBestModel(crit = c("ICL", "BIC"))
Arguments
crit

a character for the criterion used to performed the selection. Either "ICL", "BIC". Default is ICL

Returns

a PLNPCAfit object


Method plot()

Lineplot of selected criteria for all models in the collection

Usage
PLNPCAfamily$plot(criteria = c("loglik", "BIC", "ICL"), reverse = FALSE)
Arguments
criteria

A valid model selection criteria for the collection of models. Any of "loglik", "BIC" or "ICL" (all).

reverse

A logical indicating whether to plot the value of the criteria in the "natural" direction (loglik - penalty) or in the "reverse" direction (-2 loglik + penalty). Default to FALSE, i.e use the natural direction, on the same scale as the log-likelihood.

Returns

A ggplot2 object


Method show()

User friendly print method

Usage
PLNPCAfamily$show()

Method clone()

The objects of this class are cloneable with this method.

Usage
PLNPCAfamily$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

The function PLNPCA(), the class PLNPCAfit()

Examples

data(trichoptera)
trichoptera <- prepare_data(trichoptera$Abundance, trichoptera$Covariate)
myPCAs <- PLNPCA(Abundance ~ 1 + offset(log(Offset)), data = trichoptera, ranks = 1:5)
class(myPCAs)

PLN-team/PLNmodels documentation built on April 15, 2024, 9:01 a.m.