Design Resources Server

Analysis of Data from Designed Experiments

Principal Component  Analysis

IASRI
Home

<<Back

                                               Analysis Using SPSS

  Analysis Using SAS      

For the analysis of the data SAS commands are given in the sequel.

 

Data Input:

For performing analysis, input the data in the following format. 

{Here average Plant Population is termed as (PP), average Plant Height as (PH), average Number of Green Leaves as (NGL) and Yield (kg/plot) as YLD and serial number as SN. It may, however, be noted that one can retain the same name or can code in any other fashion}.

   

Data princom;    /*one can enter any other name for data*/

input sn pp ph ngl yld;

cards;

1       142.00     0.525    8.2     2.47

2       143.00     0.64      9.5     4.76

3       107.00     0.66      9.3     3.31

4        78.00      0.66      7.5     1.97

5      100.00      0.46      5.9     1.34

6        86.50      0.345    6.4     1.14

7      103.50      0.86      6.4     1.50

8      155.99      0.33      7.5     2.03

9        80.88      0.285    8.4     2.54

10     109.77     0.59    10.6    4.90

11       61.77     0.265   8.3     2.91

12       79.11     0.66    11.6    2.76

13     155.99     0.42      8.1     0.59

14       61.81     0.34      9.4     0.84

15       74.5       0.63      8.4     3.87

16       97.00     0.705    7.2     4.47

17       93.14     0.68      6.4     3.31

18       37.43     0.665    8.4     1.57

19       36.44     0.275    7.4     0.53

20       51          0.28      7.4     1.15

21     104          0.28      9.8     1.08

22       49          0.49      4.8     1.83

23       54.66     0.385    5.5     0.76

24       55.55     0.265    5.0     0.43

25       88.44     0.98     5.0     4.08

26       99.55     0.645   9.6     2.83

27       63.99     0.635   5.6     2.57

28     101.77     0.29     8.2     7.42

29     138.66     0.72     9.9     2.62

30       90.22     0.63     8.4     2.00

31       76.92     1.25     7.3     1.99

32     126.22     0.58     6.9     1.36

33       80.36     0.605   6.8     0.68

34     150.23     1.19     8.8     5.36

35       56.5       0.355   9.7     2.12

36     136          0.59    10.2    4.16

37     144.5       0.61      9.8     3.12

38     157.33     0.605    8.8     2.07

39       91.99     0.38      7.7     1.17

40     121.5       0.55      7.7     3.62

41       64.5       0.32      5.7     0.67

42      116         0.455     6.8     3.05

43      77.5        0.72     11.8    1.70

44      70.43      0.625   10      1.55

45    133.77      0.535    9.3     3.28

46      89.99      0.49      9.8     2.69

;

 

/* The following steps may be performed to compute the principal component scores on the original variables from the data.

 

The COV option in the PROC PRINCOMP statement requests the principal components to be computed from the covariance matrix.

If one omits the COV option, the principal components are computed from the correlation matrix.

 

ODS statement creates the output for the eigenvectors from the PRINCOMP procedure in the SAS libraries which is later

on used to compute the principal component scores */

 

title 'Principal component scores from the original data';

ods output eigenvectors = eigvecmat;

 

proc princomp cov data = princom;

var pp ph ngl yld;

run;

 

ods output close;

 

/* Steps to calculate the principal component scores */

/*NOTE: The following steps to compute the principal component scores is only for the above data set.

For different data sets the neccessary changes are to be made*/

 

proc iml;

use princom; /* uses the data to calculate the principal component scores */

/*reads the original variables from the data into matrix x */

read all var{pp ph ngl yld} into x; /*change the variable names according to your data set*/

use work.eigvecmat; /* uses the matrix of eigenvectors from the SAS libraries created by the ODS statement*/

/*reads the values of the eigenvectors into matrix xx */

read all var{prin1 prin2 prin3 prin4} into xx; /*change the number of variables according to the number of scores required*/

scores=xx`*x`;

pcascores=scores`; /*computes the principal component scores*/

print pcascores ; /* prints the scores for the principal component analysis*/

run;

 

 

/* Note: If one wants only eigenvalues, eigenvectors and cumulative variation explained, then one can perform the analysis without writing data=princom in the above statement, ie. one can only use

proc princomp cov;

var pp ph ngl yld;

run;*/

/*The PROC PRINCOMP statement requests by default principal components computed for the standardized data from the

correlation matrix.

 

To compute the principal component scores for the standardized data one can follow the following steps */

 

title 'Principal component scores from the standardized data';

proc princomp data = princom out=spca; /* To compute the principal component scores on the standardized data one may omit       COV option*/

var pp ph ngl yld;/*define the variable names for which the principal component scores are to be computed*/

run;

 

proc print data= work.spca;

var prin1 - prin4;  /* define the number of scores to be printed*/

run;

 

Data File

Result File

<<Back

 Analysis Using SAS                                                Analysis Using SPSS                                                                

  

                                                          

 

Home Descriptive Statistics  Tests of Significance Correlation and Regression Completely Randomised Design  RCB Design  

Incomplete Block Design  Resolvable Block Design  Augmented Design  Latin Square Design Factorial RCB Design  

Partially Confounded Design Factorial Experiment with Extra Treatments Split Plot Design Strip Plot Design 

Response Surface Design Cross Over Design  Analysis of Covariance Diagnostics and Remedial Measures 

Principal Component Analysis Cluster Analysis Groups of Experiments  Non-Linear Models  

Contact Us 

 

 

 

 

Copyright        Disclaimer        How to Quote this page        Report Error        Comments/suggestions 

Descriptive Statistics
Tests of Significance
Correlation and Regression
Completely Randomised Design
RCB Design
Incomplete Block Design
Resolvable Block Design
Augmented Design
Latin Square Design
Factorial RCB Design
Partially Confounded Design
Factorial Experiment with Extra Treatments
Split Plot Design
Strip Plot Design
Response Surface Design
Cross Over Design
Analysis of Covariance
Diagnostics and Remedial Measures
Principal Component Analysis
Cluster Analysis
Groups of Experiments
Non-Linear Models
Contact Us
Other Designed Experiments
    
(Under Development)

For exposure on SAS, SPSS, 

MINITAB, SYSTAT and  

MS-EXCEL for analysis of 

data from designed experiments:

 

Please see Module I of Electronic Book II: Advances in Data Analytical Techniques

available at Design Resource Server       
 (www.iasri.res.in/design)