The function PLNLDA() produces an instance of an object with class PLNLDAfit.
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(), the plot() method for
LDA visualization and predict() method for prediction
See also
The function PLNLDA.
Super class
PLNfit -> PLNLDAfit
Active bindings
rankthe dimension of the current model
nb_paramnumber of parameters in the current PLN model
model_para list with the matrices associated with the estimated parameters of the PLN model: B (covariates), Sigma (latent covariance), C (latent loadings), P (latent position) and Mu (group means)
percent_varthe percent of variance explained by each axis
corr_mapa matrix of correlations to plot the correlation circles
scoresa matrix of scores to plot the individual factor maps
group_meansa matrix of group mean vectors in the latent space.
Methods
Inherited methods
PLNLDAfit$new()
Initialize a PLNLDAfit object
Usage
PLNLDAfit$new(
grouping,
responses,
covariates,
offsets,
weights,
formula,
control
)Arguments
groupinga factor specifying the class of each observation used for discriminant analysis.
responsesthe matrix of responses (called Y in the model). Will usually be extracted from the corresponding field in PLNfamily-class
covariatesdesign matrix (called X in the model). Will usually be extracted from the corresponding field in PLNfamily-class
offsetsoffset matrix (called O in the model). Will usually be extracted from the corresponding field in PLNfamily-class
weightsan optional vector of observation weights to be used in the fitting process.
formulamodel formula used for fitting, extracted from the formula in the upper-level call
controllist controlling the optimization and the model
PLNLDAfit$optimize()
Compute group means and axis of the LDA (noted B in the model) in the latent space, update corresponding fields
Arguments
groupinga factor specifying the class of each observation used for discriminant analysis.
responsesthe matrix of responses (called Y in the model). Will usually be extracted from the corresponding field in PLNfamily-class
covariatesdesign matrix. Automatically built from the covariates and the formula from the call
offsetsoffset matrix (called O in the model). Will usually be extracted from the corresponding field in PLNfamily-class
weightsan optional vector of observation weights to be used in the fitting process.
configlist controlling the optimization
XAbundance matrix.
PLNLDAfit$postTreatment()
Update R2, fisher and std_err fields and visualization
Arguments
groupinga factor with group memberships
responsesthe matrix of responses (counts)
covariatesthe matrix of covariates
offsetsthe matrix of offsets
weightsan optional vector of observation weights. Default is uniform weights.
config_posta list for controlling the post-treatments (optional bootstrap, jackknife, R2, etc.).
config_optimlist controlling the optimization parameters
PLNLDAfit$setVisualization()
Compute LDA scores in the latent space and update corresponding fields.
PLNLDAfit$plot_individual_map()
Plot the factorial map of the LDA
Usage
PLNLDAfit$plot_individual_map(
axes = 1:min(2, self$rank),
main = "Individual Factor Map",
plot = TRUE
)Arguments
axesnumeric, the axes to use for the plot when map = "individual" or "variable". Default it c(1,min(rank))
maincharacter. A title for the single plot (individual or variable factor map). If NULL (the default), an hopefully appropriate title will be used.
plotlogical. Should the plot be displayed or sent back as ggplot object
Returns
a ggplot2::ggplot graphic
PLNLDAfit$plot_correlation_map()
Plot the correlation circle of a specified axis for a PLNLDAfit object
Usage
PLNLDAfit$plot_correlation_map(
axes = 1:min(2, self$rank),
main = "Variable Factor Map",
cols = "default",
plot = TRUE
)Arguments
axesnumeric, the axes to use for the plot when map = "individual" or "variable". Default it c(1,min(rank))
maincharacter. A title for the single plot (individual or variable factor map). If NULL (the default), an hopefully appropriate title will be used.
colsa character, factor or numeric to define the color associated with the variables. By default, all variables receive the default color of the current palette.
plotlogical. Should the plot be displayed or sent back as ggplot object
Returns
a ggplot2::ggplot graphic
PLNLDAfit$plot_LDA()
Plot a summary of the PLNLDAfit object
Usage
PLNLDAfit$plot_LDA(
nb_axes = min(3, self$rank),
var_cols = "default",
plot = TRUE
)Arguments
nb_axesscalar: the number of axes to be considered when map = "both". The default is min(3,rank).
var_colsa character, factor or numeric to define the color associated with the variables. By default, all variables receive the default color of the current palette.
plotlogical. Should the plot be displayed or sent back as ggplot object
PLNLDAfit$predict()
Predict group of new samples
Usage
PLNLDAfit$predict(
newdata,
type = c("posterior", "response", "scores"),
scale = c("log", "prob"),
prior = NULL,
control = PLN_param(backend = "nlopt"),
envir = parent.frame()
)Arguments
newdataA data frame in which to look for variables, offsets and counts with which to predict.
typeThe type of prediction required. The default are posterior probabilities for each group (in either unnormalized log-scale or natural probabilities, see "scale" for details), "response" is the group with maximal posterior probability and "scores" is the average score along each separation axis in the latent space, with weights equal to the posterior probabilities.
scaleThe scale used for the posterior probability. Either log-scale ("log", default) or natural probabilities summing up to 1 ("prob").
priorUser-specified prior group probabilities in the new data. If NULL (default), prior probabilities are computed from the learning set.
controla list for controlling the optimization. See
PLN()for details.envirEnvironment in which the prediction is evaluated
Examples
if (FALSE) { # \dontrun{
data(trichoptera)
trichoptera <- prepare_data(trichoptera$Abundance, trichoptera$Covariate)
myPLNLDA <- PLNLDA(Abundance ~ 1, grouping = Group, data = trichoptera)
class(myPLNLDA)
print(myPLNLDA)
} # }
