Learn R Programming

mason (version 0.3.0)

tidy_up: Convert model output to tidy tibble/dataframe.

Description

Currently this only tidies up PLS model objects. The main important output objects from the PLS model are:

Usage

tidy_up(model, output, ...)

Arguments

model

The model object.

output

Which output to choose from model.

...

Not currently used. For later method additions.

Value

Tibble object with tidied model output. There are several output options:

  • default: Tibble with five columns for the x variables, components, loadings, scores to variable correlations, and explained variance for each component and x variable combination.

  • loadings, score_corr: Tibble with three columns for x variables, components, and either loadings or score to variable correlations.

  • explained_var: Tibble with two columns for component and it's explained variance.

  • scores: Tibble with one column for each component, with values for the scores for each observation.

Details

  • Scores: These are the individual scores calculated from the model for each observation. Use these to look for patterns between components or between X or Y variables.

  • Loadings: These are the combined weights in the model (including both X and Y). Strongly correlated X variables that underlie Y will have similar loadings.

  • Explained variance: This is the amount of variance that an individual component explains within X. This is useful to use to see which components to keep.

See Also

See this website for more details on how to interpret the results of PLS.

Examples

Run this code
# NOT RUN {
library(pls)
data(yarn)

NIR <- yarn$NIR
density <- yarn$density
model <- plsr(density ~ NIR)
tidy_up(model)
tidy_up(model, "loadings")
tidy_up(model, "scores")
tidy_up(model, "score_cor")
tidy_up(model, "explained_var")

# }

Run the code above in your browser using DataLab