How to do it “Fit models”

Fit models for the different number of components
Perhaps decrease the maximal number of iterations to 500 if you are in a hurry, but don’t do that in “real life”. For each fitted model, the model of the data being Mf 
(f the number of components), can be obtained using the file nmodel.

Calculate residuals as
Ef = X - Mf;

Use these residuals for plotting purposes as was done with the raw data in the introductory chapter. Use the residuals for calculating the sum-squared residuals
(or obtain these directly in the output from the algorithm) for scree-plots.

For calculating the core consistency use the m-file corcondia
For the model with loadings in the vector Factorf calculate the core consistency as
cf = corcond(X,Factorf);

Where f is the number of components.
Compare the core consistencies for various numbers of components:

plot([1:5],[c1 c2 c3 c4 c5]) 
xlabel('Number of components') 
ylabel('Core consistency')