View source: R/feature_plspredict.R
| predict.seminr_model | R Documentation |
Generates out-of-sample predictions for a PLS model estimated by estimate_pls().
Supports models with and without interaction terms. For interaction models, the
prediction method is automatically detected from the measurement model specification:
## S3 method for class 'seminr_model'
predict(
object,
testData,
technique = predict_DA,
na.print = ".",
digits = 3,
...
)
object |
An estimated |
testData |
A data.frame of held-out test data containing all indicator columns. Must not include interaction columns (these are recreated internally). |
technique |
The prediction technique: |
na.print |
Character string for printing NA values. |
digits |
Number of digits for printing. |
... |
Additional arguments (currently unused). |
two_stage: Recreates interaction from construct-score products
product_indicator: Recreates scaled item-level products from test data
orthogonal: Recreates scaled products and applies stored orthogonalization
coefficients from estimation
Higher-order construct (HOC) models are not currently supported for prediction.
Models with mixed interaction methods (e.g., one two_stage and one
product_indicator) will produce an error.
A predicted_seminr_model object containing:
testData |
The test data (non-interaction items only). |
predicted_items |
Predicted indicator scores. |
item_residuals |
Residuals (actual - predicted) for each indicator. |
predicted_composite_scores |
Predicted construct scores. |
composite_residuals |
Residuals for construct scores. |
actual_star |
Reference construct scores from re-estimation on combined data. |
data(mobi)
mobi_mm <- constructs(
composite("Image", multi_items("IMAG", 1:5)),
composite("Expectation", multi_items("CUEX", 1:3)),
composite("Satisfaction", multi_items("CUSA", 1:3)),
interaction_term(iv = "Image", moderator = "Expectation",
method = product_indicator)
)
mobi_sm <- relationships(
paths(to = "Satisfaction",
from = c("Image", "Expectation", "Image*Expectation"))
)
model <- estimate_pls(mobi, mobi_mm, mobi_sm)
predictions <- predict(model, testData = mobi[1:20, ])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.