/*,hi,buddy,i wish it may works. The SAMPLE LIBRARY of SAS,good luck!!*/
/****************************************************************/
/* S A S S A M P L E L I B R A R Y */
/* */
/* NAME: PLSEG1 */
/* TITLE: Partial Least Squares Analysis */
/* PRODUCT: STAT */
/* SYSTEM: ALL */
/* KEYS: PLS, regression analysis, chemometrics */
/* PROCS: PLS */
/* DATA: */
/* */
/* REF: */
/* MISC: */
/* */
/****************************************************************/
/*
/ A certain chemical process involves five different reactions. For
/ 20 different runs of the process, reaction time, temperature, and
/ pressure as well as chemical yield are observed for each substi-
/ tuent reaction. The following data step reads in the data.
/---------------------------------------------------------------------*/
data process;
input time1-time5 temp1-temp5 pres1-pres5 yield1-yield5;
cards;
6.4 3.6 4.0 6.2 4.4
7 11 48 19 7
.19 .48 .17 .09 .15 37.9 99.6 88.9 54.3 73.4
7.9 7.1 7.7 9.9 5.5
22 33 60 54 34
.46 .74 .51 .26 .43 62.9 159.8 130.5 88.3 106.3
3.2 1.1 1.6 2.5 2.1
5 12 25 0 6
.04 .21 .05 .00 .03 17.4 44.6 36.6 21.5 34.2
4.3 2.6 2.2 4.3 3.0
0 0 31 20 0
.12 .32 .06 .11 .08 25.9 67.0 57.8 38.4 54.0
5.5 7.4 8.7 9.3 3.7
39 62 43 62 63
.55 .66 .73 .30 .58 62.6 146.5 117.1 83.3 84.4
2.1 2.8 2.2 3.3 1.6
5 9 15 32 12
.17 .23 .15 .18 .15 18.7 50.8 36.3 25.7 36.5
6.2 6.8 8.7 9.2 4.1
39 65 49 49 61
.51 .67 .71 .22 .54 59.2 150.7 116.2 84.4 88.2
4.2 2.5 2.9 4.2 2.8
8 14 32 15 11
.14 .33 .15 .07 .12 26.6 67.9 60.5 40.6 51.3
7.4 5.8 6.9 8.7 5.0
23 36 57 36 32
.37 .65 .45 .16 .36 55.1 143.3 114.1 80.5 97.9
5.8 4.4 5.5 6.8 3.9
20 34 45 26 29
.28 .51 .36 .11 .28 41.2 110.1 88.0 56.9 74.3
7.1 7.3 8.7 9.9 4.8
34 54 55 55 52
.52 .73 .66 .26 .52 60.7 161.2 127.1 90.4 100.2
7.7 5.7 8.0 9.0 5.0
33 57 61 28 47
.40 .68 .57 .10 .42 61.7 147.7 120.0 82.9 96.7
4.4 4.3 4.5 5.9 3.1
14 22 33 36 23
.28 .43 .30 .19 .26 38.4 96.5 73.6 50.2 63.7
1.1 2.8 1.6 2.8 1.0
3 3 7 40 10
.18 .18 .12 .23 .14 16.8 38.9 34.8 21.2 23.7
7.6 6.6 7.1 9.5 5.3
20 30 58 48 30
.42 .70 .46 .23 .39 59.3 152.1 123.6 82.9 103.0
0.0 0.0 0.0 0.0 0.0
3 9 0 4 8
.00 .00 .00 .03 .00 0.0 0.0 0.0 0.0 0.0
2.9 1.7 2.1 2.9 2.0
7 14 22 10 11
.10 .23 .11 .05 .08 21.9 48.0 37.5 24.9 37.7
4.1 2.5 3.6 4.2 2.6
15 29 32 10 22
.16 .33 .23 .04 .16 23.3 68.6 57.7 39.1 48.4
2.4 3.0 3.0 3.8 1.7
12 20 18 31 22
.21 .27 .23 .16 .20 24.8 58.2 47.9 30.5 36.3
3.8 1.9 3.0 3.6 2.4
13 26 30 4 19
.11 .29 .18 .01 .12 23.6 62.8 50.1 33.2 47.6
;
/*
/ You can use the method of partial least squares to model the
/ yields as a function of all the reaction variables. The following
/ statements print a table which summarizes how much variation each
/ PLS component accounts for.
/---------------------------------------------------------------------*/
proc pls data=process;
model yield1-yield5 = time1-time5 temp1-temp5 pres1-pres5;
run;
/*
/ Notice that the percentage of variation in Y accounted for by the
/ PLS analysis doesn't change very much after the first few compo-
/ nents. You can use the CV=ONE option to select number of compo-
/ nents by cross-validation.
/---------------------------------------------------------------------*/
proc pls data=process cv=one;
model yield1-yield5 = time1-time5 temp1-temp5 pres1-pres5;
run;
/*
/ While three PLS components give the absolute minimum predicted
/ residual sum of squares of 0.76 for the cross-validation, this
/ isn't very different from the PRESS of 0.82 for only two PLS
/ components. You can use the CVTEST option to test for the
/ significance of this difference.
/---------------------------------------------------------------------*/
proc pls data=process cv=one cvtest;
model yield1-yield5 = time1-time5 temp1-temp5 pres1-pres5;
run;
/*
/ The result is that three PLS components don't explain signifi-
/ cantly more variation than just two.*/