The function PLNPCA() produces a collection of models which are instances of object with class PLNPCAfit. This class comes with a set of methods, some of them being useful for the user: See the documentation for the methods inherited by PLNfit and the plot() methods for PCA visualization

The function PLNPCA, the class PLNPCAfamily

## Super class

PLNmodels::PLNfit -> PLNPCAfit

## Active bindings

rank

the dimension of the current model

vcov_model

character: the model used for the residual covariance

nb_param

number of parameters in the current PLN model

entropy

entropy of the variational distribution

latent_pos

a matrix: values of the latent position vector (Z) without covariates effects or offset

model_par

a list with the matrices associated with the estimated parameters of the pPCA model: B (covariates), Sigma (covariance), Omega (precision) and C (loadings)

percent_var

the percent of variance explained by each axis

corr_circle

a matrix of correlations to plot the correlation circles

scores

a matrix of scores to plot the individual factor maps (a.k.a. principal components)

rotation

a matrix of rotation of the latent space

eig

description of the eigenvalues, similar to percent_var but for use with external methods

var

a list of data frames with PCA results for the variables: coord (coordinates of the variables), cor (correlation between variables and dimensions), cos2 (Cosine of the variables) and contrib (contributions of the variable to the axes)

ind

a list of data frames with PCA results for the individuals: coord (coordinates of the individuals), cos2 (Cosine of the individuals), contrib (contributions of individuals to an axis inertia) and dist (distance of individuals to the origin).

call

Hacky binding for compatibility with factoextra functions

## Methods

Inherited methods

### Method new()

Initialize a PLNPCAfit object

PLNPCAfit$new(rank, responses, covariates, offsets, weights, formula, control) #### Arguments rank rank of the PCA (or equivalently, dimension of the latent space) responses the matrix of responses (called Y in the model). Will usually be extracted from the corresponding field in PLNfamily covariates design matrix (called X in the model). Will usually be extracted from the corresponding field in PLNfamily offsets offset matrix (called O in the model). Will usually be extracted from the corresponding field in PLNfamily weights an optional vector of observation weights to be used in the fitting process. formula model formula used for fitting, extracted from the formula in the upper-level call control a list for controlling the optimization. See details. ### Method update() Update a PLNPCAfit object #### Usage PLNPCAfit$update(
B = NA,
Sigma = NA,
Omega = NA,
C = NA,
M = NA,
S = NA,
Z = NA,
A = NA,
Ji = NA,
R2 = NA,
monitoring = NA
)

#### Arguments

B

matrix of regression matrix

Sigma

variance-covariance matrix of the latent variables

Omega

precision matrix of the latent variables. Inverse of Sigma.

C

M

matrix of mean vectors for the variational approximation

S

matrix of variance vectors for the variational approximation

Z

matrix of latent vectors (includes covariates and offset effects)

A

matrix of fitted values

Ji

vector of variational lower bounds of the log-likelihoods (one value per sample)

R2

approximate R^2 goodness-of-fit criterion

monitoring

a list with optimization monitoring quantities

#### Returns

Update the current PLNPCAfit object

### Method optimize()

Call to the C++ optimizer and update of the relevant fields

covariates,
offsets,
responses,

#### Arguments

newdata

A data frame in which to look for variables, offsets and counts with which to predict.

control

a list for controlling the optimization. See PLN() for details.

envir

Environment in which the projection is evaluated

#### Arguments

scale.unit

Logical. Should PCA scores be rescaled to have unit variance

### Method postTreatment()

Update R2, fisher, std_err fields and set up visualization

### Method clone()

The objects of this class are cloneable with this method.

PLNPCAfit$clone(deep = FALSE) #### Arguments deep Whether to make a deep clone. ## 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 = 4 Rank approximation = 5 Rank approximation = 2 Rank approximation = 1 Rank approximation = 3 #> Post-treatments #> DONE! myPCA <- getBestModel(myPCAs) class(myPCA) #> [1] "PLNPCAfit" "PLNfit" "PCA" "R6" print(myPCA) #> Poisson Lognormal with rank constrained for PCA (rank = 3) #> ================================================================== #> nb_param loglik BIC ICL #> 65 -638.096 -764.58 -823.399 #> ================================================================== #> * Useful fields #>$model_par, $latent,$latent_pos, $var_par,$optim_par
#>     $loglik,$BIC, $ICL,$loglik_vec, $nb_param,$criteria
#> * Useful S3 methods
#>     print(), coef(), sigma(), vcov(), fitted()
#>     predict(), predict_cond(), standard_error()
#> * Additional fields for PCA
#>     $percent_var,$corr_circle, $scores,$rotation, $eig,$var, \$ind
#> * Additional S3 methods for PCA
#>     plot.PLNPCAfit()