covsel: CovSel

View source: R/covsel.R

covselR Documentation

CovSel

Description

CovSel: Variable selection for highly multivariate and multi-response calibration (Roger et al. 2011).

The function can give a priori weights to the observations with argument weights (not in the original article).

Usage


covsel(X, Y, nvar = NULL, scaly = TRUE, weights = NULL)

Arguments

X

A n x p matrix or data frame of variables.

Y

A n x q matrix or data frame of responses. This can also be vector of length n if Y is univariate.

nvar

The number of variables to select in X.

scaly

If TRUE (default), each column of Y is scaled by its standard deviation.

weights

A vector of length n defining a priori weights to apply to the training observations. Internally, weights are "normalized" to sum to 1. Default to NULL (weights are set to 1 / n).

Value

sel

A data.frame where variable sel shows the column numbers of the variables selected in X.

weights

The weights used for the row observations.

References

Roger, J.M., Palagos, B., Bertrand, D., Fernandez-Ahumada, E., 2011. CovSel: Variable selection for highly multivariate and multi-response calibration: Application to IR spectroscopy. Chem. Lab. Int. Syst. 106, 216-223.

Examples


n <- 6 ; p <- 4
set.seed(1)
X <- matrix(rnorm(n * p, mean = 10), ncol = p, byrow = TRUE)
Y <- matrix(rnorm(n * 2, mean = 10), ncol = 2, byrow = TRUE)
set.seed(NULL)
X
Y

covsel(X, Y, nvar = 3)


mlesnoff/rnirs documentation built on April 24, 2023, 4:17 a.m.