Geoscience Reference
In-Depth Information
Since plotting the residuals does not reveal any obvious pattern of behavior,
no more complex model than a straight line should be i tted to the data.
plot(meters,res,'o')
An alternative way to plot the residuals is as a stem plot using stem .
subplot(2,1,1)
plot(meters,age,'o'), hold on
plot(meters,p(1)*meters+p(2),'r'), hold off
subplot(2,1,2)
stem(meters,res);
To explore the distribution of the residuals we can choose six classes and
display the corresponding frequencies.
histogram(res,6)
h e ˇ 2 -test can be used to test the hypothesis that the residuals follow a
Gaussian distribution (Section 3.9). We use chi2gof to perform the ˇ 2 -test
[h,p,stats] = chi2gof(res)
which yields
h =
0
p =
NaN
stats =
chi2stat: 0.0099
df: 0
edges: [-28.2530 -1.0404 3.4950 17.1012]
O: [14 5 11]
E: [13.7940 5.1876 11.0184]
h e result h=0 means that we cannot reject the null hypothesis without
another cause at a 5% signii cance level. However, the quality of the result
is not very good because the sample size of 30 measurements is very small.
In such an example, pooling the data could yield very low (or even zero)
expected counts. h e function chi2gof then displays a warning that the ˇ 2
approximation may not be accurate. In our example we have not dei ned
the number of bins and therefore (according to the documentation) chi2gof
should use a default of 10 bins for pooling the data. According to Section
3.9, the corresponding number of degrees of freedom should be 10-(2+1)=7
but the output of chi2gof indicates df=NaN instead. However, if there are not
Search WWH ::




Custom Search