PLSMOD Procedure
Predicting New Observations
Now that you have chosen a three-factor PLS model for predicting pollutant concentrations that are based on sample spectra, suppose that you have two new samples. The following SAS statements create a data table that contains the spectra for the new samples:
data newobs;
input obsnam $ v1-v27 @@;
datalines;
EM17 3933 4518 5637 6006 5721 5187 4641 4149 3789
3579 3447 3381 3327 3234 3078 2832 2571 2274
2040 1818 1629 1470 1350 1245 1134 1050 987
EM25 2904 2997 3255 3150 2922 2778 2700 2646 2571
2487 2370 2250 2127 2052 1713 1419 1200 984
795 648 525 426 351 291 240 204 162
;
You can apply the PLS model to these samples to estimate pollutant concentration by appending the new samples to the original 16 and specifying that the predicted values for all 18 samples be output to a data table, as shown in the following statements:
data mylib.all;
set mylib.sample newobs;
run;
proc plsmod data=mylib.all nfac=2;
model ls ha dt = v1-v27;
partition roleVar = Role(train='TRAIN' test='TEST');
output out=mylib.result pred=p copyvars=(obsnam);
run;
proc print data=mylib.result;
where (obsnam in ('EM17','EM25'));
var obsnam p_ls p_ha p_dt;
run;
The COPYVARS= option in the OUTPUT statement requests that the variable obsnam from the input data table be copied to the output data table. The new observations are not used in calculating the PLS model because they have no response values. Their predicted concentrations are shown in Figure 9.
Figure 9: Predicted Concentrations for New Observations
| Obs | obsnam | p_ls | p_ha | p_dt |
|---|---|---|---|---|
| 1 | EM17 | 2.63326 | 0.22343 | 80.2027 |
| 2 | EM25 | 0.69865 | 0.14308 | 98.9937 |