Hi,
I am trying to compute the rsquared for a data set I have; I need two, for each category: juvenile and adult organisms. This is what I have for the RSS and rsquared values:
%Compute RSS y = sum(sum(E1.^2)) + sum(sum(E2.^2))
RSSJ = sum(sum(E1.^2))
RSSA = sum(sum(E2.^2))
%Compute R-squared
residualJ = sqrt(dataJ(2:21,:)) – mean(sqrt(dataJ(2:21,:)));
squareresidualJ = residualJ.^2;
denominator = sum(sum(squareresidualJ));
rsquared = 1 – (RSSJ/denominator)
However, it says that matrix dimensions don't agree for the line containing residualJ. Anyone know what I'm doing wrong?
Best Answer