Statistics Toolbox | ![]() ![]() |
Residuals from a Principal Components Analysis
Syntax
Description
returns the pcares(X,ndim)
residuals
obtained by retaining ndim
principal components of X
. Note that ndim
is a scalar and must be less than the number of columns in X
. Use the data matrix, not the covariance matrix, with this
function.
Example
This example shows the drop in the residuals from the first row of the Hald data as the number of component dimensions increase from one to three.
load hald r1 = pcares(ingredients,1); r2 = pcares(ingredients,2); r3 = pcares(ingredients,3); r11 = r1(1,:) r11 = 2.0350 2.8304 -6.8378 3.0879 r21 = r2(1,:) r21 = -2.4037 2.6930 -1.6482 2.3425 r31 = r3(1,:) r31 = 0.2008 0.1957 0.2045 0.1921
Reference
[1] Jackson, J. E., A User's Guide to Principal Components, John Wiley and Sons, Inc. 1991. pp. 1-25.
See Also
barttest
, pcacov
, princomp
![]() | pcacov | ![]() |