Fit the PCA variants of the Poisson lognormal with a variational algorithm. Use the (g)lm syntax for model specification (covariates, offsets).

`PLNPCA(formula, data, subset, weights, ranks = 1:5, control = PLNPCA_param())`

- formula
an object of class "formula": a symbolic description of the model to be fitted.

- data
an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which lm is called.

- subset
an optional vector specifying a subset of observations to be used in the fitting process.

- weights
an optional vector of observation weights to be used in the fitting process.

- ranks
a vector of integer containing the successive ranks (or number of axes to be considered)

- control
a list-like structure for controlling the optimization, with default generated by

`PLNPCA_param()`

. See the associated documentation. for details.

an R6 object with class `PLNPCAfamily`

, which contains
a collection of models with class `PLNPCAfit`

The classes `PLNPCAfamily`

and `PLNPCAfit`

, and the configuration function `PLNPCA_param()`

.

```
#' ## Use future to dispatch the computations on 2 workers
if (FALSE) {
future::plan("multisession", workers = 2)
}
data(trichoptera)
trichoptera <- prepare_data(trichoptera$Abundance, trichoptera$Covariate)
myPCA <- PLNPCA(Abundance ~ 1 + offset(log(Offset)), data = trichoptera, ranks = 1:5)
#>
#> Initialization...
#>
#> Adjusting 5 PLN models for PCA analysis.
#> Rank approximation = 4
Rank approximation = 1
Rank approximation = 3
Rank approximation = 2
Rank approximation = 5
#> Post-treatments
#> DONE!
# Shut down parallel workers
if (FALSE) {
future::plan("sequential")
}
```