turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- Applying Results of Principal Component Analysis o...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-14-2015 05:24 PM

I started with a small data set (under 20 variables) and conducted truncation, trimming, and imputing. I finally prepped the data where I wanted it to be, and ran PROC PRINCOMP. I then used the results to run a regression model where my response variable (TARGET_WINS) = specified principal components (and only principal components).

I'm now tasked with applying my model to another data set and scoring it. This new data set is a clone of my original data set, except it has fewer observations and* no response variable*. If this were a "normal" regression and I did not use principal components, I could construct the beta coefficients from the parameter estimates, and simply substitute the variables in the new data set to create the predicted values.

But (as far as I know) since principal components are *relative* to the other data in the data set, *I have absolutely no clue* how to go about this. I can create the new principal components in the new data set, but since there's no response variable, I can't model it via PROC REG and score the predicted values.

I've taken a look at PROC SCORE, but have not had much luck. I have stored the OUTSTAT from PROC PRINCOMP in the original data set, and reduced it to only have principal components used in the regression model (from here and here). Any thoughts?

Michael

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to mgilbert

10-14-2015 10:03 PM - edited 10-14-2015 10:16 PM

Use ODS to get the eigenvectors and then proc score to get the component scores. Here is an example

```
/* Keep the first 50 observations for scoring.
Compute the two first principal components on the rest */
proc princomp data=sashelp.cars(firstobs=51) n=2 cov;
var engineSize cylinders horsepower weight wheelbase length;
ods output Eigenvectors=EV;
run;
proc transpose data=ev out=evTransposed;
var Prin1 Prin2;
id Variable;
run;
data prinScore;
set evTransposed;
_TYPE_ = "SCORE";
run;
/* Compute the first two component scores for the
first 50 observations */
proc score data=sashelp.cars(obs=50) score=prinScore out=scoredCars;
run;
```

PG

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to PGStats

10-15-2015 08:01 AM

Thanks - I'll give this a shot tonight.

Less on the procedure but more on the theory side... Once I get the new data scored, it is then appropriate to hand-code the regression equation using the beta coefficients from the old data, and substituting the new scored data in? Greatly appreciate the help.

Michael

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to mgilbert

10-16-2015 08:40 AM

If "beta coefficients from the old data" means "beta coefficients from the regression that uses the prinipal components as explanatory variables," then the answer is yes. Remember that the prinipal components are just linear combinations of your original explanatory variables. When you score the new data, you are creating coordinates in a new coordinate system in which the prinipal components replace the usual (x,y,z,...) coordinates. Mathematically, this is called a change of basis.