Learn R Programming

seminr (version 2.0.0)

predict_pls: 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.

Examples

Run this code
# NOT RUN {
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)

# }

Run the code above in your browser using DataLab