Learn R Programming

pls (version 2.8-5)

pls.options: Set or return options for the pls package

Description

A function to set options for the pls package, or to return the current options.

Usage

pls.options(...)

Value

A list with the (possibly changed) options. If any named argument (or list element) was provided, the list is returned invisibly.

Arguments

...

a single list, a single character vector, or any number of named arguments (name = value).

Author

Bjørn-Helge Mevik and Ron Wehrens

Details

If called with no arguments, or with an empty list as the single argument, pls.options returns the current options.

If called with a character vector as the single argument, a list with the arguments named in the vector are returned.

If called with a non-empty list as the single argument, the list elements should be named, and are treated as named arguments to the function.

Otherwise, pls.options should be called with one or more named arguments name = value. For each argument, the option named name will be given the value value.

The recognised options are:

mvralg

The fit method to use in mvr and mvrCv. The value should be one of the allowed methods. Defaults to "kernelpls". Can be overridden with the argument method in mvr and mvrCv.

pcralg

The fit method to use in pcr. The value should be one of the allowed methods. Defaults to "svdpc". Can be overridden with the argument method in pcr.

plsralg

The fit method to use in plsr. The value should be one of the allowed methods. Defaults to "kernelpls". Can be overridden with the argument method in plsr.

cpplsalg

The fit method to use in cppls. The value should be one of the allowed methods. Defaults to "cppls". Can be overridden with the argument method in cppls.

parallel

Specification of how the cross-validation (CV) in mvr should be performed. If the specification is NULL (default) or 1, the CV is done serially, otherwise it is done in parallel using functionality from the parallel package.

If it is an integer greater than 1, the CV is done in parallel with the specified number of processes, using mclapply.

If it is a cluster object created by makeCluster, the CV is done in parallel on that cluster, using parLapply. The user should stop the cluster herself when it is no longer needed, using stopCluster.

Finally, if the specification is an unevaluated call to makeCluster, the call is evaluated, and the CV is done in parallel on the resulting cluster, using parLapply. In this case, the cluster will be stopped (with stopCluster) after the CV. Thus, in the final case, the cluster is created and destroyed for each CV, just like when using mclapply.

w.tol

The tolerance used for removing values close to 0 in the vectors of loading weights in cppls. Defaults to .Machine$double.eps.

X.tol

The tolerance used for removing predictor variables with L1 norms close to 0 in cppls. Defaults to 10^-12.

Examples

Run this code

## Return current options:
pls.options()
pls.options("plsralg")
pls.options(c("plsralg", "pcralg"))

## Set options:
pls.options(plsralg = "simpls", mvralg = "simpls")
pls.options(list(plsralg = "simpls", mvralg = "simpls")) # Equivalent
pls.options()

## Restore `factory settings':
pls.options(list(mvralg = "kernelpls", plsralg = "kernelpls", cpplsalg = "cppls",
                 pcralg = "svdpc", parallel = NULL,
                 w.tol = .Machine$double.eps, X.tol = 10^-12))
pls.options()

Run the code above in your browser using DataLab