plo_inter: Plot of Interactions

View source: R/plo_inter.R

plo_interR Documentation

Plot of Interactions

Description

Plots the interaction between two categorical supplementary variables for a PLS regression.

Usage

plo_inter(object, var1, var2, excl1 = NULL, excl2 = NULL,
  comps = c(1,2), shapesize = 1, textsize = 3,
  force = 1, max.overlaps = Inf,
  lines = TRUE, dashes = TRUE)

Arguments

object

an object of class mvr from pls package

var1

factor. The first categorical supplementary variable.

var2

factor. The second categorical supplementary variable.

excl1

character vector of categories from the var1 to exclude from the plot. If NULL (default), all the supplementary categories are plotted.

excl2

character vector of categories from the var2 to exclude from the plot. If NULL (default), all the supplementary categories are plotted.

comps

the components to use. Default is c(1,2).

shapesize

Size of the shapes. Default is 1.

textsize

Size of the labels of categories. Default is 3.

force

Force of repulsion between overlapping text labels. Defaults to 1. If 0, labels are not repelled at all.

max.overlaps

Exclude text labels that overlap too many things. Defaults to Inf, which means no labels are excluded.

lines

logical. Whether to add colored lines between the points of the categories of v1. Default is TRUE.

dashes

logical. Whether to add gray dashed lines between the points of the categories of v2. Default is TRUE.

Value

a ggplot2 object

Author(s)

Nicolas Robette

References

Martens, H., Næs, T. (1989) Multivariate calibration. Chichester: Wiley.

Tenenhaus, M. (1998) La Regression PLS. Theorie et Pratique. Editions TECHNIP, Paris.

See Also

plo_sup, plo_part

Examples

library(pls)
data(mpg, package = "ggplot2")
pls <- mvr(displ ~ cty + hwy + cyl,
           ncomp = 3,
           data = mpg,
           validation = "CV",
           method = "oscorespls")
supvars <- data.frame(class = factor(mpg$class), trans = factor(mpg$trans))
plo_inter(pls, factor(mpg$class), factor(mpg$trans), lines = FALSE, dashes = FALSE)

morepls documentation built on June 8, 2025, 10:34 a.m.