How can I test PCR model?

3 visualizzazioni (ultimi 30 giorni)
Ezz El-din Abdullah
Ezz El-din Abdullah il 19 Giu 2018
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!

Risposte (0)

Categorie

Scopri di più su Dimensionality Reduction and Feature Extraction in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by