Maximilian
Maximilian

Reputation: 1375

Why do I get error message trying to crossvalidate PCR using matlab?

I am using the commands proposed here. When I execute

PCRmsep = sum(crossval(@pcrsse,X,Y,'KFold',6),1) / n;

I get the following error messages:

Error using crossval>evalFun (line 480) The function 'pcrsse' generated the following error: Index exceeds matrix dimensions.

Error in crossval>getFuncVal (line 497) funResult = evalFun(funorStr,arg(:));

Error in crossval (line 343) funResult = getFuncVal(1, nData, cvp, data, funorStr, []);

What does this error mean and how can I prevent this error?

X: 24x9 matrix

Y: 24x1 matrix

Upvotes: 0

Views: 269

Answers (1)

clare.s
clare.s

Reputation: 26

I'm new to Matlab and also trying to use this function. I was getting the same error and had a look at the function. For me, saving a copy and changing the maxNumComp value from 10 to 8 (I have 8 predictors) made it work. Yet to figure out why...

Upvotes: 1

Related Questions