Bug in Matlab/statistics toolbox or is there a typo in the plsregress example? (or something wrong with my Matlab installation?)

조회 수: 2 (최근 30일)
I’m having problems with getting the partial least squares regression to work properly and I suspect that there either is something wrong with my matlab installation or that there is a bug in matlab/statistics toolbox. If I type:
help plsregress
I get this example:
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');
but when I run these two lines exactly as in the example:
load spectra
[xl,yl,xs,ys,beta,pctvar,mse] = plsregress(NIR,octane,10,'CV',10);
I get this:
Error using horzcat
Dimensions of matrices being concatenated are not consistent.
Error in crossval
Error in plsregress>plscv (line 351)
sumsqerr = crossval(CVfun,X,Y,cvpType,cvp,'mcreps',mcreps,'options',ParOptions);
Error in plsregress (line 214)
mse = plscv(X,Y,ncomp,cvp,mcreps,ParOptions);
Could someone be kind enough to type the two lines in your matlab and see if it works for you? And if it doesn’t, is there a typo in how the example is written or is there a bug in matlab/statistics toolbox?
  댓글 수: 2
Steven Lord
Steven Lord 2016년 3월 11일
Which release of the toolbox are you using?
Are you executing the example from the online documentation or from the documentation included in your installation? If you're executing the online example, check if it's different than the example in your locally installed documentation.
Petter Stefansson
Petter Stefansson 2016년 3월 11일
It was from a locally installed documentation. But I tried installing the new 2016a vesion of matlab (together with a potentially newer version of statistics toolbox) and now the exact same lines work! So either there was a bug in the version I was using before or something was wrong with my installation. For now at least it seems solved with 2016a, so thats good.

댓글을 달려면 로그인하십시오.

채택된 답변

Petter Stefansson
Petter Stefansson 2016년 3월 11일
If others are running into the same problem, it seems to be solved by updating to matlab 2016a!

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Gaussian Process Regression에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by