Learn R Programming

PLNmodels (version 0.9.5)

PLNPCA: Poisson lognormal model towards Principal Component Analysis

Description

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

Usage

PLNPCA(
  formula,
  data,
  subset,
  weights,
  ranks = 1:5,
  control_init = list(),
  control_main = list()
)

Arguments

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 weights to be used in the fitting process. Should be NULL or a numeric vector.

ranks

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

control_init

a list for controling the optimization at initialization. See details of function PLN.

control_main

a list for controling the main optimization process. See details.

Value

an R6 object with class PLNPCAfamily, which contains a collection of models with class PLPCAfit

Details

The list of parameters control_main controls the optimization of the main process, with the following entries

  • "ftol_rel"stop when an optimization step changes the objective function by less than ftol multiplied by the absolute value of the parameter. Default is 1e-8

  • "ftol_abs"stop when an optimization step changes the objective function by less than ftol multiplied by the absolute value of the parameter. Default is 0

  • "xtol_rel"stop when an optimization step changes every parameters by less than xtol multiplied by the absolute value of the parameter. Default is 1e-4

  • "xtol_abs"stop when an optimization step changes every parameters by less than xtol multiplied by the absolute value of the parameter. Default is 1e-4

  • "lower_bound"the lower bound (box constraint) for the variational variance parameters. Default is 1e-4.

  • "maxeval"stop when the number of iteration exceeds maxeval. Default is 10000

  • "maxtime"stop when the optimization time (in seconds) exceeds maxtime. Default is -1 (no restriction)

  • "algorithm"the optimization method used by NLOPT among LD type, i.e. "CCSAQ", "MMA", "LBFGS", "VAR1", "VAR2". See NLOPT documentation for further details. Default is "CCSAQ".

  • "trace"integer for verbosity. Useless when cores > 1

  • "cores"The number of core used to paralellize jobs over the ranks vector. Default is 1.

See Also

The classes PLNPCAfamily and PLNPCAfit

Examples

Run this code
# NOT RUN {
data(trichoptera)
trichoptera <- prepare_data(trichoptera$Abundance, trichoptera$Covariate)
myPCA <- PLNPCA(Abundance ~ 1 + offset(log(Offset)), data = trichoptera, ranks = 1:5)
# }

Run the code above in your browser using DataLab