predict_pls: Predict_pls performs either k-fold or LOOCV on a SEMinR PLS...

View source: R/feature_plspredict.R

predict_plsR Documentation

Predict_pls performs either k-fold or LOOCV on a SEMinR PLS model and generates predictions

Description

predict_pls uses cross-validation to generate in-sample and out-sample predictions for PLS models generated by SEMinR.

Usage

predict_pls(model, technique, noFolds, reps, cores)

Arguments

model

A SEMinR model that has been estimated on the FULL dataset.

technique

The predictive technique to be employed, Earliest Antecedents (EA) predict_EA or Direct Antecedents (DA) predict_DA

noFolds

The required number of folds to use in k-fold cross validation. If NULL, then parallel LOOCV will be executed. Default is NULL.

reps

The number of times the cross-validation will be repeated. Default is NULL.

cores

The number of cores to use for parallel LOOCV processing. If k-fold is used, the process will not be parallelized.

Details

This function generates cross-validated in-sample and out-sample predictions for PLS models generated by SEMinR. The cross validation technique can be k-fold if a number of folds are specified, or leave-one-out-cross-validation (LOOCV) if no folds arew specified. LOOCV is recommended for small datasets.

Value

A list of the estimated PLS and LM prediction results:

PLS_out_of_sample

A matrix of the out-of-sample indicator predictions generated by the SEMinR model.

PLS_in_sample

A matrix of the in-sample indicator predictions generated by the SEMinR model.

lm_out_of_sample

A matrix of the out-of-sample indicator predictions generated by a linear regression model.

lm_in_sample

A matrix of the in-sample indicator predictions generated by a linear regression model.

item_actuals

A matrix of the actual indicator scores.

PLS_out_of_sample_residuals

A matrix of the out-of-sample indicator PLS prediction residuals.

PLS_in_sample_residuals

A matrix of the in-sample indicator PLS prediction residuals.

lm_out_of_sample_residuals

A matrix of the out-of-sample LM indicator prediction residuals.

lm_in_sample_residuals

A matrix of the in-sample LM indicator prediction residuals.

mmMatrix

A Matrix of the measurement model relations.

smMatrix

A Matrix of the structural model relations.

constructs

A vector of the construct names.

mmVariables

A vector of the indicator names.

outer_loadings

The matrix of estimated indicator loadings.

outer_weights

The matrix of estimated indicator weights.

path_coef

The matrix of estimated structural model relationships.

iterations

A numeric indicating the number of iterations required before the algorithm converged.

weightDiff

A numeric indicating the minimum weight difference between iterations of the algorithm.

construct_scores

A matrix of the estimated construct scores for the PLS model.

rSquared

A matrix of the estimated R Squared for each construct.

inner_weights

The inner weight estimation function.

data

A matrix of the data upon which the model was estimated (INcluding interactions.

rawdata

A matrix of the data upon which the model was estimated (EXcluding interactions.

measurement_model

The SEMinR measurement model specification.

Examples

data(mobi)

# seminr syntax for creating measurement model
mobi_mm <- constructs(
  composite("Image",        multi_items("IMAG", 1:5)),
  composite("Expectation",  multi_items("CUEX", 1:3)),
  composite("Value",        multi_items("PERV", 1:2)),
  composite("Satisfaction", multi_items("CUSA", 1:3))
)

mobi_sm <- relationships(
  paths(to = "Satisfaction",
        from = c("Image", "Expectation", "Value"))
)

mobi_pls <- estimate_pls(mobi, mobi_mm, mobi_sm)
cross_validated_predictions <- predict_pls(model = mobi_pls,
                                           technique = predict_DA,
                                           noFolds = 10,
                                           cores = NULL)


seminr documentation built on Oct. 13, 2022, 1:05 a.m.