## Not run:
# Y <- log(as.matrix(aircraft[ , -(1:2)]))
# year <- aircraft$Yr
# h <- h.select(year, Y[ , 1], method = "df", df = 4)
# spca <- sm.pca(year, Y, h, display = "none")
# sm.pca(year, Y, h, display = "eigenvalues")
# sm.pca(year, Y, h, display = "eigenvectors", ylim = c(-1, 1))
#
# # The following code shows how the plots can be redrawn from the returned object
#
# spca <- sm.pca(year, Y, h, display = "eigenvalues")
# spca <- sm.pca(year, Y, h, display = "eigenvectors", ylim = c(-1, 1))
#
# with(spca, {
# ylim <- range(evals[ , 1], band)
# plot(xgrid, evals[ , 1], type = "n", ylab = "Variance", ylim = ylim)
# polygon(c(xgrid, rev(xgrid)), c(band[ , 1], rev(band[ , 2])),
# col = "lightgreen", border = NA)
# lines(xgrid, evals[ , 1], col = "red")
# })
#
# with(spca, {
# pc <- 1
# plot(range(xgrid.plot), range(evecs.plot), type = "n",
# xlab = "x", ylab = "PC loadings")
# for (i in 1:ncol(Y))
# segments(xgrid.plot[-length(xgrid.plot)],
# evecs.plot[-nrow(evecs.plot), i],
# xgrid.plot[-1], evecs.plot[-1, i],
# col = col.plot[ , i], lty = i)
# })
# ## End(Not run)
Run the code above in your browser using DataLab