MATLAB Answers

chaya d y

correlation should be less than or equal to 1 but in my case it is exceeding,so give me a solution

Asked by chaya d y
on 2 Feb 2013

sir i'm using matlab to run PCR and PLSR model for correlating the results for example RMSE should not exceed 1 but the problem what i'm facing is after running the program i'm getting RMSE as 1.22,i coding what i'm using is Partial Least Square Regression (PLSR) analysis: % Standardize data set using zscore function

X = zscore(X1); y = Y1;

% Fit with more no. of components


% Crossvalidation method to find optimum no.of components to be used in model

[Xl,Yl,Xs,Ys,beta,pctVar,PLSmsep] = plsregress(X,y,10,'CV',10); figure,plot(0:10,PLSmsep(2,:),'b-o'); xlabel('Number of components'); ylabel('Estimated Mean Squared Prediction Error'); legend({'PLSR'},'location','NE'); figure,plot(1:10,cumsum(100*PLSPctVar(2,:)),'-bo'); xlabel('Number of PLS components'); ylabel('Percent Variance Explained in Y');

% x=zscore(calibx); y=caliby; [Xloadings,Yloadings,Xscores,Yscores,betaPLS] = plsregress(x,y,3);

% get the beta coefficients from calibration set and predict y value % X1=validset,n=no.of rows yfitPLS = [ones(n,1) X1]*betaPLS;

% Calculation of r2 value and RMSE TSS = sum((y-mean(y)).^2); RSS_PLS = sum((y-yfitPLS).^2); rsquaredPLS = 1 - RSS_PLS/TSS; rmse=sqrt(sum((y(:)-yfitPLS(:)).^2)/numel(y))

can i get a solution where i have gone wrong.

thanking you




No products are associated with this question.

1 Answer

Answer by Tom Lane
on 2 Feb 2013

In general, unless there is something special about your problem, it is perfectly reasonable for rmse to be larger than 1. It's an estimate of the standard deviation of the error term in the units of the response vector y. Multiply y by 10 and rmse will be larger by the same factor.

R-square is a unitless quantity that should be less than 1.


Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!