Types

CPPLS relies on two main custom types in the StatsAPI.fit and StatsAPI.predict workflow. CPPLSModel stores the user-controlled model specification, including the number of components, the gamma configuration, centering, the analysis mode, and numerical tolerances. CPPLSFit is the full fitted model returned by fit; it contains regression coefficients, scores, labels, and other quantities needed for prediction, diagnostics, and plotting. A third container, CPPLSFitLight, stores only the subset of fitted-model information needed for cross-validation. It is an internal optimization and is typically not accessed directly by users.

The package provides getters for fields that are commonly useful in downstream work. For CPPLSModel, the getters are gamma, mode, and ncomponents. For CPPLSFit, the getters are coef, mode, fitted, gamma, gammas, rhos, predictorlabels, responselabels, residuals, sampleclasses, samplelabels, and xscores.

Both container types contain additional named fields of possible interest. You can inspect them with propertynames(spec) or propertynames(model) and access them directly via dot notation, for example spec.X_loading_weight_tolerance.

CPPLSModel

CPPLS.CPPLSModelType
CPPLSModel{T}

Model specification passed to fit. A CPPLSModel stores the user-controlled settings for CPPLS fitting, most importantly ncomponents, gamma, centering and scaling of predictor and response variables, and mode.

source
CPPLS.gammaMethod
gamma(model::CPPLSModel)

Return the gamma requested in the model.

source
CPPLS.modeMethod
mode(model::CPPLSModel)

Return the analysis mode requested in the model.

source
CPPLS.ncomponentsMethod
ncomponents(model::CPPLSModel)

Return the number of components requested in the model.

source

AbstractCPPLSFit

CPPLS.AbstractCPPLSFitType
AbstractCPPLSFit

Common supertype for fitted CPPLS models that share the fields B, Xbar, Ybar, and mode.

source
StatsAPI.coefMethod
coef(fit::AbstractCPPLSFit)
coef(fit::AbstractCPPLSFit, ncomponents::Integer)

Return the regression coefficient matrix for the final (or requested) number of components.

source
CPPLS.coefallMethod
coefall(fit::AbstractCPPLSFit)

Return the regression coefficients for the fitted model.

source

CPPLSFit

CPPLS.CPPLSFitType
CPPLSFit{T1, T2}

Full fitted CPPLS model returned by fit. This type stores regression coefficients together with the intermediate quantities needed for diagnostics, projections, and plotting.

Most users will work with a CPPLSFit through predict, project, coef, fitted, residuals, xscores, and the various label getters rather than by accessing fields directly.

source
StatsAPI.fittedMethod
fitted(fit::CPPLSFit)
fitted(fit::CPPLSFit, ncomponents::Integer)

Return the fitted response matrix for the final (or requested) number of components.

source
CPPLS.gammaMethod
gamma(fit::CPPLSFit)

Return the power-parameter values selected during fitting.

source
CPPLS.gammasMethod
gammas(fit::CPPLSFit)
gammas(fit::CPPLSFit, latent_variable::Integer)

Return the matrix of per-candidate gamma values considered during fitting, or the column for a specific latent variable.

source
CPPLS.modeMethod
mode(fit::CPPLSFit)

Return the analysis mode for the fitted model.

source
StatsAPI.residualsMethod
residuals(fit::CPPLSFit)
residuals(fit::CPPLSFit, ncomponents::Integer)

Return the response residual matrix for the final (or requested) number of components.

source
CPPLS.responselabelsMethod
responselabels(fit::CPPLSFit)

Return the response labels (response names or class names) for the fitted model.

source
CPPLS.rhosMethod
rhos(fit::CPPLSFit)
rhos(fit::CPPLSFit, latent_variable::Integer)

Return the matrix of per-candidate squared canonical correlations considered during fitting, or the column for a specific latent variable.

source
CPPLS.sampleclassesMethod
sampleclasses(fit::CPPLSFit)

Return the per-sample class labels stored for discriminant analysis models, or nothing for regression fits.

source
CPPLS.xscoresMethod
xscores(fit::CPPLSFit)
xscores(fit::CPPLSFit, comp::Integer)
xscores(fit::CPPLSFit, comps::AbstractUnitRange{<:Integer})
xscores(fit::CPPLSFit, comps::AbstractVector{<:Integer})

Return the predictor score matrix T for the fitted model, or a subset of its columns:

  • xscores(fit) returns the full score matrix (all components).
  • xscores(fit, comp) returns the column for a single component as a vector.
  • xscores(fit, comps::AbstractUnitRange) returns a matrix with the selected range of components.
  • xscores(fit, comps::AbstractVector) returns a matrix with the specified components (in given order).

Throws an error if any requested component index is out of bounds.

source

CPPLSFitLight

CPPLS.CPPLSFitLightType
CPPLSFitLight{T}

Reduced fitted CPPLS model that retains only the information needed for prediction. This type is used mainly for efficient internal prediction during cross-validation.

Most users will work with CPPLSFit instead.

source