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