View source: R/utility_functions.R
get_loadings | R Documentation |
Returns the loadings of a mixOmics spls train object. Either from the final model fitted on the full training data, or the median and sd across CV folds from the best performing tuning parameters. If there are multiple CV repeats, these are separated or can be chosen.
get_loadings(trainobj, what = c("finalModel", "CV"), xykeep = c("x", "y", "both"), rep = NA, remove_empty = TRUE, ncomp = NA, keepX = NA, keepY = NA)
trainobj |
The |
what |
Which model to return loadings from. Either |
xykeep |
Return loadings from x or y? Either |
rep |
If |
remove_empty |
Remove loadings with a value of zero from output. |
ncomp |
Manually select CV predictions with this parameter. |
keepX |
Manually select CV predictions with this parameter. |
keepY |
Manually select CV predictions with this parameter. |
A data.frame
with the variables
var
- the variable
comp
- the component
loading
- the loading value (median if across CV folds / reps)
sd
- the standard deviation of the loading (if across CV folds / reps, NA otherwise)
xy
- is it a loading on x or y?
library(caret) x <- data.frame(matrix(rnorm(1000),nrow = 100)) y <- rnorm(100) PLS <- train(x = x, y = y, method = get_mixOmics_spls()) get_loadings(PLS) get_loadings(PLS, "CV") %>% ggplot(aes(var, loading, ymin = loading - sd, ymax = loading + sd)) + facet_wrap(~ comp, scales = "free_x") + geom_errorbar() + geom_bar(stat = "identity")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.