Title: | Interpretation Tools for Partial Least Squares Regression |
---|---|
Description: | Various kinds of plots (observations, variables, correlations, weights, regression coefficients and Variable Importance in the Projection) and aids to interpretation (coefficients, Q2, correlations, redundancies) for partial least squares regressions computed with the 'pls' package, following Tenenhaus (1998, ISBN:2-7108-0735-1). |
Authors: | Nicolas Robette [aut, cre] |
Maintainer: | Nicolas Robette <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.1 |
Built: | 2024-11-05 06:17:37 UTC |
Source: | CRAN |
Computes the standardized and raw coefficients of a PLS regression, with p-values and confidence intervals from a jackknife procedure.
get_coef(object, y = NULL, ncomp = NULL, ci = 0.95, raw = FALSE)
get_coef(object, y = NULL, ncomp = NULL, ci = 0.95, raw = FALSE)
object |
an object of class |
y |
the name of the response variable whose coefficients are plotted. If |
ncomp |
the number of components to use for computing coefficients |
ci |
the confidence level of the confidence interval. Default is 0.95. |
raw |
logical. If |
A data frame with coefficients, standard deviation, t-values, p-values and confidence intervals.
Nicolas Robette
Martens, H., Næs, T. (1989) Multivariate calibration. Chichester: Wiley.
Tenenhaus, M. (1998) La Regression PLS. Theorie et Pratique. Editions TECHNIP, Paris.
library(pls) data(yarn) pls <- mvr(density ~ NIR, ncomp = 5, data = yarn, validation = "CV", method = "oscorespls", jackknife = TRUE) res <- get_coef(pls) head(res)
library(pls) data(yarn) pls <- mvr(density ~ NIR, ncomp = 5, data = yarn, validation = "CV", method = "oscorespls", jackknife = TRUE) res <- get_coef(pls) head(res)
Computes correlations between variables and scores from a PLS regression.
get_cor(object)
get_cor(object)
object |
an object of class |
A list with the following elements :
Xt |
correlations between X variables and X scores |
Yt |
correlations between Y variables and X scores |
Xu |
correlations between X variables and Y scores |
Yu |
correlations between Y variables and Y scores |
XY |
correlations between X variables and Y variables |
tu |
correlations between X scores and Y scores |
Nicolas Robette
Martens, H., Næs, T. (1989) Multivariate calibration. Chichester: Wiley.
Tenenhaus, M. (1998) La Regression PLS. Theorie et Pratique. Editions TECHNIP, Paris.
library(pls) data(yarn) pls <- mvr(density ~ NIR, ncomp = 5, data = yarn, validation = "CV", method = "oscorespls") res <- get_cor(pls) str(res)
library(pls) data(yarn) pls <- mvr(density ~ NIR, ncomp = 5, data = yarn, validation = "CV", method = "oscorespls") res <- get_cor(pls) str(res)
Computes Q2 and cumulative Q2 indexes from a PLS regression.
get_Q2(object)
get_Q2(object)
object |
an object of class |
A list with the following elements :
Q2kh |
Q2 index by X variable and number of components |
Q2h |
Q2 index by number of components |
Q2cumkh |
cumulative Q2 index by X variable and number of components |
Q2cumh |
cumulative Q2 index by number of components |
Nicolas Robette
Martens, H., Næs, T. (1989) Multivariate calibration. Chichester: Wiley.
Tenenhaus, M. (1998) La Regression PLS. Theorie et Pratique. Editions TECHNIP, Paris.
library(pls) data(yarn) pls <- mvr(density ~ NIR, ncomp = 5, data = yarn, validation = "CV", method = "oscorespls") res <- get_Q2(pls) str(res)
library(pls) data(yarn) pls <- mvr(density ~ NIR, ncomp = 5, data = yarn, validation = "CV", method = "oscorespls") res <- get_Q2(pls) str(res)
Computes R2 and redundancies between variables and scores from a PLS regression.
get_red(object)
get_red(object)
object |
an object of class |
A list with the following elements :
Xt |
R2 and redundancies between X variables and X scores |
Yt |
R2 and redundancies between Y variables and X scores |
Xu |
R2 and redundancies between X variables and Y scores |
Yu |
R2 and redundancies between Y variables and Y scores |
Xtcum |
cumulative R2 and redundancies between X variables and X scores |
Ytcum |
cumulative R2 and redundancies between Y variables and X scores |
Xucum |
cumulative R2 and redundancies between X variables and Y scores |
Yucum |
cumulative R2 and redundancies between Y variables and Y scores |
Nicolas Robette
Martens, H., Næs, T. (1989) Multivariate calibration. Chichester: Wiley.
Tenenhaus, M. (1998) La Regression PLS. Theorie et Pratique. Editions TECHNIP, Paris.
library(pls) data(yarn) pls <- mvr(density ~ NIR, ncomp = 5, data = yarn, validation = "CV", method = "oscorespls") res <- get_red(pls) str(res)
library(pls) data(yarn) pls <- mvr(density ~ NIR, ncomp = 5, data = yarn, validation = "CV", method = "oscorespls") res <- get_red(pls) str(res)
Plots the coefficients from a PLS regression.
plo_coef(object, y = NULL, ncomp = NULL, sort = FALSE, col = "darkgreen", repel = FALSE, max.pval = NULL, whiskers = FALSE, ci = 0.95)
plo_coef(object, y = NULL, ncomp = NULL, sort = FALSE, col = "darkgreen", repel = FALSE, max.pval = NULL, whiskers = FALSE, ci = 0.95)
object |
an object of class |
y |
the name of the response variable whose coefficients are plotted. If |
ncomp |
the number of components to use for computing coefficients |
sort |
logical. If |
col |
color of the bars |
repel |
logical. If |
max.pval |
coefficients with jack-knife p-values higher than |
whiskers |
logical. If |
ci |
the confidence level of the confidence interval. Only used if |
a ggplot2
object
Nicolas Robette
Martens, H., Næs, T. (1989) Multivariate calibration. Chichester: Wiley.
Tenenhaus, M. (1998) La Regression PLS. Theorie et Pratique. Editions TECHNIP, Paris.
library(pls) data(yarn) pls <- mvr(density ~ NIR, ncomp = 5, data = yarn, validation = "CV", method = "oscorespls", jackknife = TRUE) plo_coef(pls) plo_coef(pls, max.pval = 0.05) plo_coef(pls, whiskers = TRUE)
library(pls) data(yarn) pls <- mvr(density ~ NIR, ncomp = 5, data = yarn, validation = "CV", method = "oscorespls", jackknife = TRUE) plo_coef(pls) plo_coef(pls, max.pval = 0.05) plo_coef(pls, whiskers = TRUE)
Plots the correlations between (X and Y) variables and the components (X scores) of a PLS regression.
plo_cor(object, comps = 1:2, which = "both", min.cor = NULL, lim = NULL, circles = NULL, col = NULL, size = 3.88)
plo_cor(object, comps = 1:2, which = "both", min.cor = NULL, lim = NULL, circles = NULL, col = NULL, size = 3.88)
object |
an object of class |
comps |
the components to use. Default is |
which |
character string. If |
min.cor |
numerical value. The minimal correlation with one or the other component for a variable to be plotted. If |
lim |
numerical value. The limit of the scale (in absolute value). If |
circles |
vector of numeric values. Circles are added to the plot at radiuses specified in |
col |
colors for the names of the variables. Only one value should be provided if |
size |
numerical value. The size of the names of the variables. |
a ggplot2
object
This is what Tenenhaus calls the univariate interpretation of the PLS components, as opposed to the multivariate interpretation (see plo_var
).
Nicolas Robette
Martens, H., Næs, T. (1989) Multivariate calibration. Chichester: Wiley.
Tenenhaus, M. (1998) La Regression PLS. Theorie et Pratique. Editions TECHNIP, Paris.
library(pls) data(yarn) pls <- mvr(density ~ NIR, ncomp = 5, data = yarn, validation = "CV", method = "oscorespls") plo_cor(pls) # plot with circles corresponding to # correlations of 0.5 and 1 plo_cor(pls, lim = 1, circles = c(0.5, 1), col = c("pink", "purple"))
library(pls) data(yarn) pls <- mvr(density ~ NIR, ncomp = 5, data = yarn, validation = "CV", method = "oscorespls") plo_cor(pls) # plot with circles corresponding to # correlations of 0.5 and 1 plo_cor(pls, lim = 1, circles = c(0.5, 1), col = c("pink", "purple"))
Plots the weights of X variables from a PLS regression.
plo_ctr(object, comp = 1, sort = FALSE, col = "tomato4", repel = FALSE)
plo_ctr(object, comp = 1, sort = FALSE, col = "tomato4", repel = FALSE)
object |
an object of class |
comp |
the component to use. Default is 1. |
sort |
logical. If |
col |
color of the bars |
repel |
logical. If |
According to Tenenhaus, the contribution of a variable to the construction of a component is measured by the squared loading weight. For a given component, the sum af the squared loading weights is equal to 1. This plot represents the loading weights, which keeps the information about their sign. Dashed lines are added at +/- sqrt(1/p), with p the number of X variables, which corresponds to the average contribution to the construction of the component.
a ggplot2
object
Nicolas Robette
Martens, H., Næs, T. (1989) Multivariate calibration. Chichester: Wiley.
Tenenhaus, M. (1998) La Regression PLS. Theorie et Pratique. Editions TECHNIP, Paris.
library(pls) data(yarn) pls <- mvr(density ~ NIR, ncomp = 5, data = yarn, validation = "CV", method = "oscorespls") plo_ctr(pls)
library(pls) data(yarn) pls <- mvr(density ~ NIR, ncomp = 5, data = yarn, validation = "CV", method = "oscorespls") plo_ctr(pls)
Plots the scores of the observations of a PLS regression.
plo_obs(object, comps = 1:2, col = "black", size = 1.5)
plo_obs(object, comps = 1:2, col = "black", size = 1.5)
object |
an object of class |
comps |
the components to use. Default is |
col |
the color of the points. |
size |
numerical value. The size of the points. |
a ggplot2
object
Nicolas Robette
Martens, H., Næs, T. (1989) Multivariate calibration. Chichester: Wiley.
Tenenhaus, M. (1998) La Regression PLS. Theorie et Pratique. Editions TECHNIP, Paris.
library(pls) data(yarn) pls <- mvr(density ~ NIR, ncomp = 5, data = yarn, validation = "CV", method = "oscorespls") plo_obs(pls)
library(pls) data(yarn) pls <- mvr(density ~ NIR, ncomp = 5, data = yarn, validation = "CV", method = "oscorespls") plo_obs(pls)
Plots the loadings of the variables of a PLS regression.
plo_var(object, comps = 1:2, which = "both", col = NULL, size = 3.88, Yline = TRUE, col.Yline = "firebrick3")
plo_var(object, comps = 1:2, which = "both", col = NULL, size = 3.88, Yline = TRUE, col.Yline = "firebrick3")
object |
an object of class |
comps |
the components to use. Default is |
which |
character string. If |
col |
colors for the names of the variables. Only one value should be provided if |
size |
numerical value. The size of the names of the variables. |
Yline |
logical. If |
col.Yline |
the color of the lines drawn if |
a ggplot2
object
This is what Tenenhaus calls the multivariate interpretation of the PLS components, as opposed to the univariate interpretation provided by the correlations (see plo_cor
). This superposes Y loadings (vectors from the C matrix) and projections, i.e. modified weights (vectors of the W* matrix).
Nicolas Robette
Martens, H., Næs, T. (1989) Multivariate calibration. Chichester: Wiley.
Tenenhaus, M. (1998) La Regression PLS. Theorie et Pratique. Editions TECHNIP, Paris.
library(pls) data(yarn) pls <- mvr(density ~ NIR, ncomp = 5, data = yarn, validation = "CV", method = "oscorespls") plo_var(pls)
library(pls) data(yarn) pls <- mvr(density ~ NIR, ncomp = 5, data = yarn, validation = "CV", method = "oscorespls") plo_var(pls)
Plots the Variable Importance in Projections (VIP) indexes of a PLS regression.
plo_vip(object, ncomp = NULL, sort = FALSE, col = "steelblue4", repel = FALSE)
plo_vip(object, ncomp = NULL, sort = FALSE, col = "steelblue4", repel = FALSE)
object |
an object of class |
ncomp |
the number of components to use for computing VIPs |
sort |
logical. If |
col |
color of the bars |
repel |
logical. If |
a ggplot2
object
Nicolas Robette
Martens, H., Næs, T. (1989) Multivariate calibration. Chichester: Wiley.
Tenenhaus, M. (1998) La Regression PLS. Theorie et Pratique. Editions TECHNIP, Paris.
library(pls) data(yarn) pls <- mvr(density ~ NIR, ncomp = 5, data = yarn, validation = "CV", method = "oscorespls") plo_vip(pls)
library(pls) data(yarn) pls <- mvr(density ~ NIR, ncomp = 5, data = yarn, validation = "CV", method = "oscorespls") plo_vip(pls)