trans
function.regr
. An object of class "regr"
in plot.regr
."NL"
(default), the current working directory is taken. As well used in pred.regr
."raw"
(raw spectra), "derivative"
(derivative spectra), "continuum removed"
(continuum removed spectra) and "wt"
(wavelet coefficien"pls"
(partial least-squares), "brt"
(boosted regression trees) and "svm"
(support vector machines).x
(given in pn
). If "FALSE"
object n
is taken.p
is "FALSE"
.bandwidth
.r
is equal to "pls"
. Available are "none"
(no cross-validation procedure), "CV"
(cross-validation in 10 segments) and "LOO"
(dwt
function from wavelets
package.gbm.fit
function.gbm.fit
function.gbm.fit
function.svm
function."regr"
."regr"
.pred.regr
.regr
returns a list with class "regr"
containing the following components excluding the last four ones. pred.regr
returns a list with class "pred.regr"
containing the last four components output.name
, predicted.values
, method
, and spectral.transformation
(see below):"mvr"
, "gbm"
or "svm"
.pred.regr
.pred.regr
."prcomp"
for each constituent calibration set. Needed for pred.regr
.pred.regr
.pred.regr
.pred.regr
.pred.regr
.x
. Needed for pred.regr
.pred.regr
.pred.regr
.pred.regr
.pred.regr
.pred.regr
.CRAN
system. The code for this has been tested and works and those who are intrested can contact the author for the code file which can be called locally the same way local functions are loaded in R systemy
are allowed.regr
uses the mvr
function in the pls
package for partial least-squares regression, the gbm.fit
function in the gbm
package for boosted regression trees and the svm
function in the e1071
package for support vector machines regression. The number of important PLS latent variables and the svm parameter optimization is done automatically based on experience with soil spectra.
sp
uses for spectral transformation (i) the locpoly
function in KernSmooth
package for derivative calculation, (ii) the chull
and approx
functions in "KernSmooth"
package for continuum removal and (iii) the dwt
function in wavelets
package for extraction of wavelet coefficients. Experiences showed for wavelet decomposition that the best ratio of prediction performance and sparse spectral representation is reached when all 128 wavelet coefficients from decomposition lv three are taken (which is the default).
Settings in the used functions for regression and transformation are chosen based on experience with soil spectra calibrations. It is recommended to take the given default values. Nevertheless, the settings can be adapted to a certain degree. In case you want to use complete functionality use the named functions directly. If r
is "brt"
, the number of samples has to be more than 70.
Column names of x
and new
must contain the wavebands. Wavebands are made automatically compatible if needed (see details in read.spc).
.
Constituent values are not always normally distributed. This can violate prerequisitives for regression methods. Thus, transformation prior regression can solve this problem. The regr
function uses log, square root and box-cox transformation aside untransformed values and let the user decide graphically which transformation to take for each constituent.
Predictions from pred.regr
are given back with the prediction uncertainty for each individual sample (based on the validation set prediction error). The prediction uncertainty is calculated as the root median square error of prediction (RMedianSEP) using a moving window of in maximum 50 samples with similar predicted values. From the RMedianSEP the confidence interval is calculated.
Predictions are only made if (i) the new spectrum lies within the mahalanobis space of the calibration set, (ii) there is a local neighbor within of 5 and (iii) the predicted value lies within the calibration set range. Otherwise they are set to NA
values. Mahalanobis distance can only be calculated when the number of calibration samples is higher than the number of wavebands/variables.
Calibration statistics contains for each constituents (i) n
the number of samples used in calibration, (ii) r2
the coefficient of determination for the linear regression of measured against predicted values, (iii) a
the slope of the regression line, (iv) bias
the bias, (v) RMSEC
the root means square error of calibration, (vi) RPD
the ratio of constituent standard deviation to RMSEC, (vii) n LV
the number of latent variables used when r
is equal to "pls"
, (viii) n bc out
the number of backtransformed values being NA
values after box-cox transformation and (ix) n trees
the number of trees when r
is equal to "brt"
. Validation statistics contains for each constituents points (i) to (vi). The RMSEC is logically the RMSEP.
The calibration and validation regressions of all constituents are plotted and the statistics printed in the Console.
Nearly each run of regr
yields following warning message: