plantphys / spectratrait

A tutorial R package for illustrating how to fit, evaluate, and report spectra-trait PLSR models. The package provides functions to enhance the base functionality of the R pls package, identify an optimal number of PLSR components, standardize model validation, and vignette examples that utilize datasets sourced from EcoSIS (ecosis.org)
GNU General Public License v3.0
11 stars 9 forks source link

Create new apply function that applies PLSR models to new data #80

Open serbinsh opened 3 years ago

serbinsh commented 3 years ago

apply_plsr(..) to take plsr coefficients/permutation coefficients and input spectra matrix to generate new values in a dataframe.

Options should be: input coefficients as either R object or a specific file(s) Input reflectance as either an R matrix or a specific file wavelength prefix (e.g. "Wave_") metadata_columns - those in the input spectra to keep in the output object

I don't see this overly complicated but we will want to have a check that wavelengths match. also need to indicate if there is an intercept and where it is.

Im sure other considerations will come up.

Use EcoSIS spectra and built-in coefficients as examples

As part of this build in the Serbin et al 2019 LMA coefficients

serbinsh commented 3 years ago

Would want the functionality to match something like this script:

https://github.com/TESTgroup-BNL/spectratrait/blob/perc_rmse_fix/vignettes/apply_sserbin2019_plsr_to_neon_example.md

but with more flexibility and to simplify how to do this for end users

could add the option to use github files for coefficients like in this script example