필터 지우기
필터 지우기

How to fit a PLS function with an intercept?

조회 수: 5 (최근 30일)
gsourop
gsourop 2021년 1월 29일
Dear all,
I am using the plsregress function to derive the betas. I want to test a different number of components to see which number fits the model best based on the BIC or another criterion (rather than using the default mse). I would like to use an intercept within my specifications. However, I am not sure if the following is correct
T =100;
x = [ones(T,1) randn(T,10)];
y = randn(T,1);
for k = 1 :11
[xl, yl,xs,ys,betapls] = plsregress(x,y,k);
beta_k(k,:) = betapls;
xfitted = xs(:,1:k) * xl(:,1:k)';
yfitted = xs(:,1:k) * yl(:,1:k)';
xresiduals = x - xfitted;
yresiduals = y - yfitted;
N=k+1;
BICCriterionY(k)=log(yresiduals'*yresiduals/T)+N*log(T)/T;
end
[minBIC,k_star]=min(BICCriterionY);
Is the above correct or do I also need to calculate the criterion for the intercept differently? Should I also calculate the BIC for xfitted as well? If yes, I am not quite sure how to do it.
Thank you in advance.

답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by