R/linear_combination.R
linear_combination.Rd
Use linear regression resp. non negative
linear regression (package nnls) without intercept to estimate
coefficients for a linear combination of reference spectra to represent
one or multiple target spectra. For a sparse solution and/or correlated
references see omp
.
linear_combination( targets, references, references_ids = NULL, nonnegative = FALSE )
targets | a hyperSpec object. |
---|---|
references | a hyperSpec object containing the spectra to be combined in in a linear manner. |
references_ids | either a single string or numeric specifying the column with names for the references in the object `references`, or a character vector with a name per reference spectrum. |
nonnegative | logical; set TRUE to restrict coefficients to be positive. |
a list containing the following members:
coefficient matrix
the references object as supplied
the return value of the multivariate call to `stats::lm()` or a list of return values of the outputs of `nnls::nnls()` for each target spectrum.