Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

How to Determine the number of the components in plsregress()?

$
0
0
When I use plsregress() function in Matlab, I have to give a value of ncomp which stands for the number of the components of PLS method. If I don't so, Matlab will assign a default value to this input argument, which equals to min(size(X,1)-1,size(X,2)). But I don't want use this default value because it may not be the best for prediction of new observations. So the first question is how to determine the optimal number of the components? Can Cross Validation do this? Please tell me in details if you know.
What's more, when I run the demo program in Matlab R2011a:
     load spectra
     [xl,yl,xs,ys,beta,pctvar,mse] = plsregress(NIR,octane,10,'CV',10);
     plot(0:10,mse(2,:),'-o');
     octaneFitted = [ones(size(NIR,1),1) NIR]*beta;
     plot(octane,octaneFitted,'o');
I got the following error information:

??? Undefined function or method
'getargs' for input arguments of type
'cell'.

Error in ==> plsregress at 149
[eid,errmsg,cvp,mcreps,ParOptions] =
getargs(names, dflts, varargin{:});

Error in ==> pls at 2
     [xl,yl,xs,ys,beta,pctvar,mse] =
     plsregress(NIR,octane,10,'resubstitution',1);
Can you tell me the reason of it ? And how to revise the program?

 Thanks
Haidong Chen

Viewing all articles
Browse latest Browse all 19628

Trending Articles