Calculation of OPLS model predictions using new data

predict_opls(opls_model, newdata, idx_scale = NULL)

Arguments

opls_model

OPLS model (regression of discriminant analysis) of class OPLS_MetaboMate.

newdata

NMR data matrix or dataframe with rows representing spectra and identical features in columns as data matrix used to calculate original OPLS model.

idx_scale

int vector, row-indices of newdata used to subselect samples to determine scale and center pars. Recommded: set to NULL: use center and scaling parameters from opsl training data

Value

Returned is a list with the following elements:

Y_predicted

Class or numeric outcome predictions for discriminant analysis or regression, repspectively.

t_pred

Predicted OPLS model scores for predictive component(s).

t_orth

Predicted OPLS model scores for orthogonal component(s).

t_orth_pca

Scores of a PCA model (first component) calculated using all predicted OPLS orthogonal component scores - only done when there are more than one orthogonal components in opls_model.

Details

Class predictions for discriminant analysis are not adjusted for unbalanced sample sizes and therefore, predictions can be biased towards the group with the largest number of samples. The list element t_orth_pca represent scores of the first principal component of a PCA model caclulated with all orthogonal components, therefore, summarises all orthogonal components into a single one. This can only be done if there are more than one orthogonal components in opls_modelel, otherwise this list element is NULL.

References

Trygg J. and Wold, S. (2002) Orthogonal projections to latent structures (O-PLS). Journal of Chemometrics, 16.3, 119-128.

Geladi, P and Kowalski, B.R. (1986), Partial least squares and regression: a tutorial. Analytica Chimica Acta, 185, 1-17.

See also

opls

Other NMR ++: .hotellingsT2(), cvanova(), es_cdelta(), minmax(), opls_perm(), pca(), plotscores(), pqn(), scRange()

Author

torben.kimhofer@murdoch.edu.au

Examples

data(covid) model=opls(X, Y=an$type)
#> Performing discriminant analysis.
#> Error in .checkDimXY(X, y_check[[1]]): Error: Dimensions of input X and Y do not match.
preds=predict_opls(model, X)
#> Error in is(opls_model): object 'model' not found
table(preds$Y_predicted, an$type)
#> Error in table(preds$Y_predicted, an$type): object 'preds' not found