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().
See also
The function PLNPCA(), the class PLNPCAfit()
Super class
PLNfamily -> PLNPCAfamily
Methods
Inherited methods
PLNPCAfamily$new()
Initialize all models in the collection.
A single SVD of the residual matrix M - X*B is computed once and shared across
all ranks. M and B come from either a user-provided PLNfit inception or a
fast LM on log-transformed counts (default, controlled by init_method).
Usage
PLNPCAfamily$new(
ranks,
responses,
covariates,
offsets,
weights,
formula,
control
)Arguments
ranksthe dimensions of the successively fitted models
responsesthe matrix of responses common to every models
covariatesthe matrix of covariates common to every models
offsetsthe matrix of offsets common to every models
weightsthe vector of observation weights
formulamodel formula used for fitting, extracted from the formula in the upper-level call
controllist controlling the optimization and the model
PLNPCAfamily$getModel()
Extract model from collection and add "PCA" class for compatibility with factoextra::fviz()
Arguments
varvalue 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.
indexInteger index of the model to be returned. Only the first value is taken into account.
Returns
a PLNPCAfit object
PLNPCAfamily$getBestModel()
Extract best model in the collection
Usage
PLNPCAfamily$getBestModel(crit = c("ICL", "BIC"))Arguments
crita character for the criterion used to performed the selection. Either "ICL", "BIC". Default is
ICL
Returns
a PLNPCAfit object
PLNPCAfamily$plot()
Lineplot of selected criteria for all models in the collection
Usage
PLNPCAfamily$plot(criteria = c("loglik", "BIC", "ICL"), reverse = FALSE)Arguments
criteriaA valid model selection criteria for the collection of models. Any of "loglik", "BIC" or "ICL" (all).
reverseA 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::ggplot object
Examples
data(trichoptera)
trichoptera <- prepare_data(trichoptera$Abundance, trichoptera$Covariate)
myPCAs <- PLNPCA(Abundance ~ 1 + offset(log(Offset)), data = trichoptera, ranks = 1:5)
#>
#> Initialization...
#>
#> Adjusting 5 PLN models for PCA analysis.
#> Rank approximation = 1
Rank approximation = 2
Rank approximation = 3
Rank approximation = 4
Rank approximation = 5
#> Post-treatments
#> DONE!
class(myPCAs)
#> [1] "PLNPCAfamily" "PLNfamily" "R6"
