pca <- prcomp (~ spc, data = flu$., center = FALSE)
scores <- decomposition (flu, pca$x, label.wavelength = "PC",
label.spc = "score / a.u.")
loadings <- decomposition (flu, t(pca$rotation), scores = FALSE,
label.spc = "loading I / a.u.")
plotspc (loadings, stacked = TRUE, col = matlab.palette(6))
plotc (scores[,,1], plot.args = list(ylim = range(scores[[]])))
for (i in 2 : nwl (scores))
plotc (scores[,,i], add = TRUE, plot.args = list (col = matlab.palette(6)[i]))
pca$sdev
## everything besides the first component is just noise
## Reconstructing the data using only the first PC results in a noise
## filtered data set.
flu.filtered <- scores[,,1]
## example 2
pca <- prcomp (~ spc, data = chondro$., tol = 0.1)
scores <- decomposition (chondro, pca$x, label.wavelength = "PC",
label.spc = "score / a.u.")
plotmap (scores[,,1])
Run the code above in your browser using DataLab