Learn R Programming

plsmod (version 0.1.2)

pls: General Interface for Partial Least Squares (PLS)

Description

pls() is a way to generate a specification of a model before fitting and allows the model to be created using R. The main arguments for the model are:

  • predictor_prop: The proportion of predictors that are allowed to affect each PLS loading.

  • num_comp: The number of PLS components to retain.

These arguments are converted to their specific names at the time that the model is fit. Other options and argument can be set using set_engine(). If left to their defaults here (NULL), the values are taken from the underlying model functions. If parameters need to be modified, update() can be used in lieu of recreating the object from scratch.

Usage

pls(mode = "unknown", predictor_prop = NULL, num_comp = NULL)

# S3 method for pls update( object, parameters = NULL, predictor_prop = NULL, num_comp = NULL, fresh = FALSE, ... )

Arguments

mode

A single character string for the type of model. Possible values for this model are "unknown", "regression", or "classification".

predictor_prop

The maximum proportion of original predictors that can have non-zero coefficients for each PLS component (via regularization). This value is used for all PLS components for X.

num_comp

The number of PLS components to retain.

object

A PLS model specification.

parameters

A 1-row tibble or named list with main parameters to update. If the individual arguments are used, these will supersede the values in parameters. Also, using engine arguments in this object will result in an error.

fresh

A logical for whether the arguments should be modified in-place of or replaced wholesale.

...

Not used for update().

Engine Details

Engines may have pre-set default arguments when executing the model fit call. The possible model calls are shown in the Examples section below.

Details

The model can be created using the fit() function using the following engines:

  • R: "mixOmics" (the default)

Examples

Run this code
# NOT RUN {
pls(num_comp = 2, predictor_prop = 0.2) %>%
  set_engine("mixOmics") %>%
  set_mode("regression") %>%
  translate()

pls(num_comp = 2, predictor_prop = 1) %>%
  set_engine("mixOmics") %>%
  set_mode("classification") %>%
  translate()

pls(num_comp = 6) %>%
  set_engine("mixOmics") %>%
  set_mode("regression") %>%
  translate()

pls() %>%
  set_engine("mixOmics") %>%
  set_mode("classification") %>%
  translate()


model <- pls(predictor_prop =  0.1)
model
update(model, predictor_prop = 1)
update(model, predictor_prop = 1, fresh = TRUE)
# }

Run the code above in your browser using DataLab