Set of functions to help in PLS-PM analysis in spatial ecological applications
The currently included functions are:
- plspmPredict
- plspm.groupsPredict
- plspmResiduals
@author: Javier Lopatin
This function predicts PLS-PM latent and measurement variables from a 'plspm' object ('plspm' R-package)
This is based on the publication: Shmueli, G., Ray, S., Estrada, J. M., & Chatla, S. (n.d.). The Elephant in the Room: Evaluating the Predictive Performance of Partial Least Squares (PLS) Path Models (2015). SSRN Electronic Journal SSRN Journal.
The script was adapted from the script: https://github.com/ISS-Analytics/pls-predict/blob/master/lib/PLSpredict.R
The adaptation was done in order to work directly with an plspm object.
WARNING: For the moment, only working with class(data) == data.frame
object for prediction. Raster classes to be added
Usage:
plspmPred(pls, dat, ...)
Arguments:
- pls: An plspm object from the plspm package
- dat: data.frame or Raster Stack with the model predictors
Details:
The function plspmPredict estimates extrapolation values of Latent and Measurement Variables from and plspm object
Values:
An object of class plspmPredict
is returned. The object returns a list with:
-
mmData
Matrix or RasterStack of the input measurement variables
-
mmPredicted
Matrix or RasterStack of the predicted all measurement variables
-
mmResiduals
Matrix of the residuals of all measurement variables. Only if validation data of the target endogenous variables are provided for validation
-
Scores
Matrix of the predicted Latent Variables scores [in ordination units]. Only if validation data of the target endogenous variables are provided for validation
-
r_square
Matrix of Squared Pearson's Correlation values of all measurement variables. Only if validation data of the target endogenous variables are provided for validation
-
RMSE
Matrix of Root-Mean-Square-Error values of all measurement variables Only if validation data of the target endogenous variables are provided for validation
-
nRMSE
Matrix of normalizedRoot-Mean-Square-Error [%] values of all measurement variables. Only if validation data of the target endogenous variables are provided for validation
-
bias
Matrix of bias values of all measurement variables. Only if validation data of the target endogenous variables are provided for validation
Usage:
plspm.groupsPredict(pls, pls.groups, train.groups, dat)
Details:
This function has the same functions as plspmPredict
, but uses a plspm.groups
object as input. Therefore, it gives a list of predicted scores, measurement variables, and residuals for the 'general', 'group1', and 'group2' models.
Usage:
plspmRsiduals(pls)
Arguments:
- pls: An plspm object from the plspm package
- dat: data.frame or Raster Stack with the model predictors
Details:
This function obtain residuals for all Latent and Measurement variables from an 'plspm' object
Values:
An object of class plspmResiduals
is returned. The object returns a list with:
-
inner_residuals
Matrix of residual values for the Latent Variables
-
outer_residuals
Matrix of residual values for the Measurement Variables