MATLAB Examples

book_3_50a.m

Use normalqqplot

load fly

uniqueTemp = unique(Temperature);
nT = length(uniqueTemp);
meanFacet = nan(nT,1);

for ii = 1:nT
   index = Temperature==uniqueTemp(ii);
   meanFacet(ii) = mean(FacetNumber(index));
end

p = polyfit(uniqueTemp(:),meanFacet(:),1);
fitFacet = polyval(p,uniqueTemp);
residual = meanFacet(:)-fitFacet(:);

normalqqplot(residual)