01.03.2013 Views

Applied Statistics Using SPSS, STATISTICA, MATLAB and R

Applied Statistics Using SPSS, STATISTICA, MATLAB and R

Applied Statistics Using SPSS, STATISTICA, MATLAB and R

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

336 8 Data Structure Analysis<br />

using matrix x either as data matrix (icov ≠ 0) or as covariance matrix<br />

(icov = 0).<br />

The R eigen function behaves as the <strong>MATLAB</strong> eig function. For instance,<br />

the eigenvalues <strong>and</strong> eigenvectors of Table 8.1 can be obtained with<br />

eigen(cov(cbind(ART[1:50],PRT[1:50]))). The prcomp function<br />

computes among other things the principal components (curiously, called<br />

“rotation” or “loadings” in R) <strong>and</strong> their st<strong>and</strong>ard deviations (square roots of the<br />

eigenvalues). For the dataset of Example 8.1 one would use:<br />

> p p<br />

St<strong>and</strong>ard deviations:<br />

[1] 117.65407 13.18348<br />

Rotation:<br />

PC1 PC2<br />

[1,] 0.3500541 0.9367295<br />

[2,] 0.9367295 -0.3500541<br />

We thus obtain the same eigenvectors (PC1 <strong>and</strong> PC2) as in Table 8.1 (with an<br />

unimportant change of sign). The st<strong>and</strong>ard deviations are the square roots of the<br />

eigenvalues listed in Table 8.1. With the R princomp function, besides the<br />

principal components <strong>and</strong> their st<strong>and</strong>ard deviations, one can also obtain the data<br />

projections onto the eigenvectors (the so-called scores in R).<br />

A scree plot (see section 8.2) can be obtained in R with the screeplot<br />

function using as argument an object returned by the princomp function. The R<br />

factanal function performs factor analysis (see section 8.4) of the data matrix x<br />

returning the number of factors specified by factors with the specified<br />

rotation method. Bartlett’s test scores can be specified with scores.<br />

The R implemented functions pccorr <strong>and</strong> velcorr behave in the same way<br />

as their <strong>MATLAB</strong> counterparts.<br />

<br />

Figure 8.4. Partial view of <strong>STATISTICA</strong> specification window for principal<br />

component analysis with st<strong>and</strong>ardised data.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!