How can I test PCR model?

조회 수: 3 (최근 30일)
Ezz El-din Abdullah
Ezz El-din Abdullah 2018년 6월 19일
I'm new to modeling principle component regression. I used MATLAB documentation to see an example on how to do it using the built-in functions. I just want to know how to test the model to try other examples than the training set.
This is the piece of code I want to investigate:
[PCALoadings,PCAScores,PCAVar] = princomp(X); %,'Economy',false);
betaPCR = regress(y-mean(y), PCAScores(:,1:2));
betaPCR = PCALoadings(:,1:2)*betaPCR;
betaPCR = [mean(y) - mean(X)*betaPCR; betaPCR];
yfitPCR = [ones(n,1) X]*betaPCR;
I think X should be the X that I want to test. The question is, what is 'y' here? This y I don't know, I actually want to predict it. Thanks!

답변 (0개)

카테고리

Help CenterFile Exchange에서 Dimensionality Reduction and Feature Extraction에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by