MATLAB Answers

Vicky
1

Can PLSregress handle no intercept

Asked by Vicky
on 8 Feb 2011
Latest activity Answered by John D'Errico
on 14 Sep 2019
I'm reading the comments inside plsregress code and this block mentions the intercept term in regression:
% [XL,YL,XS,YS,BETA] = PLSREGRESS(X,Y,NCOMP,...) returns the PLS regression % coefficients BETA. BETA is a (P+1)-by-M matrix, containing intercept % terms in the first row, i.e., Y = [ONES(N,1) X]*BETA + RESIDUALS, and % Y0 = X0*BETA(2:END,:) + RESIDUALS.
The regression beta contains the intercept term.
My question is
Can plsregress function deal with cases when one doesn't want an explicit intercept term? ie. I want the beta for
Y = X * BETA + residuals (so size P only, not P+1).
Can anyone direct me to the portion of the code that one can modify to take out the intercept term in the estimation process?

  0 Comments

Sign in to comment.

Tags

1 Answer

Answer by John D'Errico
on 14 Sep 2019

It is NEVER a good idea to hack toolbox code.
The exceptions are where you know enough to be able to write the modified algorithm yourself, so that you could write the code from scratch anyway. Of course then, I'd still not advide you modify complex code, but just write your own version, perhaps without some of the bells and whistles that you never use anyway.
A serious risk of modifying such code is you forget that you did it, and now the code does not match the documentation. Then of course, you will forget that you did the deadly deed a year from now, and then you will go crazy trying to figure out why it no longer works as expected. Or, someone else might accidentally get your hacked version of the code, not realizing what you did. Or, some other piece of code that uses the hacked code now mysteriously fails.

  0 Comments

Sign in to comment.