Geoscience Reference
In-Depth Information
enough degrees of freedom to conduct the test, chi2gof returns a p -value of
NaN , as in our example. Alternatively, we use chi2gof with 6 bins
[h,p,stats] = chi2gof(res,'NBins',6)
which yields
h =
0
p =
0.1481
stats =
chi2stat: 2.0922
df: 1
edges: [-28.2530 -5.5759 1.9832 9.5422 17.1012]
O: [11 7 5 7]
E: [8.8282 8.4603 7.3927 5.3187]
As indicated by df=1 and the number of edges ( edges ), chi2gof now uses 4
bins instead of 6 bins dei ned by NBins=6 in chi2gof in order to avoid bins with
very low (or even zero) expected counts. h e function chi2gof then yields a
p -value of 0.1481 indicating that the result is signii cant and we cannot reject
the null hypothesis that the residuals follow a Gaussian distribution.
4.5 Bootstrap Estimates of the Regression Coei cients
In this section we use the bootstrap method to obtain a better estimate of
the regression coei cients. As an example we use the function bootstrp with
1000 samples (Fig. 4.6).
clear
agedepth = load('agedepth_1.txt');
meters = agedepth(:,1);
age = agedepth(:,2);
p = polyfit(meters,age,1);
rng(0)
p_bootstrp = bootstrp(1000,'polyfit',meters,age,1);
h e statistic of the i rst coei cient, i.e., the slope of the regression line is
histogram(p_bootstrp(:,1),15)
median(p_bootstrp(:,1))
Search WWH ::




Custom Search