puchwein(X,pc=0.95,k,min.sel,details=FALSE,.center = TRUE,.scale = FALSE)
data.frame
or matrix
from
which to select calibration samplespc < 1
,
the number of principal components kept corresponds to
the number of components explaining at least (pc *
100
) percent of the total variance (default = 0.95 as in
the Puchwein paper).TRUE
, adds a
component in the output list with the indices of the
objects kept in each loop (default to FALSE
)list
with components: model
' indices of the observations (row
indices of the input data) selected for calibration
test
' indices of the remaining observations
(row indices of the input data) pc
'a
numeric matrix
of the scaled pc scores
loop.optimal
' index of the loop producing
the maximum difference between the observed and theoretical
sum of leverages of the selected samples
leverage
' data.frame
giving the
observed and theoretical cumulative sums of leverage of the
points selected in each loop details
' list
with the indices of the observations kept in each loop matrix
and extracts the score matrix truncated
to $A$, the number of principal components. The score
matrix is then normalized to unit variance and the
Euclidean distance of each sample to the centre of the data
is computed, which is identical to the Mahalanobis distance
$H$. Additionally, the Mahalanobis distances between
samples are comptuted. The algorithm then proceeds as
follows:
It is not possible to obtain a pre-defined number of
samples selected by the method. To choose the adequate
number of samples, a data.frame
is returned by
puchwein
function (leverage
) giving the
observed and theoretical cumulative sum of leverages of the
points selected in each iteration. The theoretical
cumulative sum of leverage is computed such as each point
has the same leverage (the sum of leverages divided by the
number of observations). The loop having the largest
difference between the observed and theoretical sums is
considered as producing the optimal selection of points
(the subset that best reproduces the variability of the
predictor space).
Shetty, N., Rinnan, A., and Gislum, R., 2012. Selection of representative calibration sample sets for near-infrared reflectance spectroscopy to predict nitrogen concentration in grasses. Chemometrics and Intelligent Laboratory Systems 111, 59-65.
kenStone
, duplex
,
shenkWest
, honigs
,
naes
data(NIRsoil)
sel <- puchwein(NIRsoil$spc,k=0.2,pc=.99)
plot(sel$pc[,1:2])
# points selected for calibration
points(NIRsoil$spc[sel$model,1:2],col=2,pch=2)
# Leverage plot
opar <- par(no.readonly=TRUE)
par(mar=c(4,5,2,2))
plot(sel$leverage$loop,sel$leverage$diff,type='l',
xlab='# loops',ylab='Difference between theoretical and \n observed sum of leverages')
par(opar)
Run the code above in your browser using DataLab