Learn R Programming

PLNmodels (version 0.9.5)

PLNPCAfit: An R6 Class to represent a PLNfit in a PCA framework

Description

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.PLNPCAfit methods for PCA vizualization

Arguments

Super class

PLNmodels::PLNfit -> PLNPCAfit

Public fields

var_par

a list with two matrices, M and S, which are the estimated parameters in the variational approximation

latent

a matrix: values of the latent vector (Z in the model)

optim_par

a list with parameters useful for monitoring the optimization

loglik

variational lower bound of the loglikelihood

BIC

variational lower bound of the BIC

ICL

variational lower bound of the ICL

R_squared

approximated goodness-of-fit criterion

criteria

a vector with loglik, BIC, ICL, R_squared and number of parameters

Active bindings

rank

the dimension of the current model

model_par

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

var_par

a list with two matrices, M and S, which are the estimated parameters in the variational approximation

latent

a matrix: values of the latent vector (Z in the model)

optim_par

a list with parameters useful for monitoring the optimization

loglik

variational lower bound of the loglikelihood

BIC

variational lower bound of the BIC

ICL

variational lower bound of the ICL

R_squared

approximated goodness-of-fit criterion

criteria

a vector with loglik, BIC, ICL, R_squared and number of parameters

nb_param

number of parameters in the current PLN model

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 comonents)

rotation

a matrix of rotation of the latent space

Methods

Public methods

Method new()

Usage

PLNPCAfit$new(rank, responses, covariates, offsets, weights, model, control)

Method update()

Usage

PLNPCAfit$update(
  Theta = NA,
  Sigma = NA,
  B = NA,
  M = NA,
  S = NA,
  Z = NA,
  A = NA,
  Ji = NA,
  R2 = NA,
  monitoring = NA
)

Method setVisualization()

Usage

PLNPCAfit$setVisualization(scale.unit = FALSE)

Method optimize()

Usage

PLNPCAfit$optimize(responses, covariates, offsets, weights, control)

Method postTreatment()

Usage

PLNPCAfit$postTreatment(responses, covariates, offsets, weights, nullModel)

Method latent_pos()

Usage

PLNPCAfit$latent_pos(covariates, offsets)

Method plot_individual_map()

Usage

PLNPCAfit$plot_individual_map(
  axes = 1:min(2, self$rank),
  main = "Individual Factor Map",
  plot = TRUE,
  cols = "default"
)

Method plot_correlation_circle()

Usage

PLNPCAfit$plot_correlation_circle(
  axes = 1:min(2, self$rank),
  main = "Variable Factor Map",
  cols = "default",
  plot = TRUE
)

Method plot_PCA()

Usage

PLNPCAfit$plot_PCA(
  nb_axes = min(3, self$rank),
  ind_cols = "ind_cols",
  var_cols = "var_cols",
  plot = TRUE
)

Method compute_fisher()

Usage

PLNPCAfit$compute_fisher(type = c("wald", "louis"), X = NULL)

Method show()

Usage

PLNPCAfit$show()

Method clone()

The objects of this class are cloneable with this method.

Usage

PLNPCAfit$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

See Also

The function PLNPCA, the class PLNPCAfamily

Examples

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

Run the code above in your browser using DataLab