Page 60 - MATLAB Recipes for Earth Sciences
P. 60
3.6 The t–Test 51
tions normpdf(x,mu,sigma) and normcdf(x,mu,sigma) to compute
the PDF and CDF of a gaussian distribution with mean Mu=12.3448 and
Sigma=1.1660, evaluated at the values in x in order to compare the result
with our sample data set.
x = 9:0.1:15;
pdf = normpdf(x,12.3448,1.1660);
cdf = normcdf(x,12.3448,1.1660);
plot(x,pdf,x,cdf)
MATLAB also provides a GUI-based function for generating PDFs and
CDFs with specific statistics, which is called disttool.
disttool
We choose pdf as function type and Mu=12.3448 and Sigma=1.1660.
The function disttool uses the non-GUI functions for calculating prob-
ability density functions and cumulative distribution functions, such as
normpdf and normcdf.
3.6 The t–Test
The Student·s t–test by William Gossett (1876-1937) compares the means
of two distributions. Let us assume that two independent sets of n and n
a b
measurements that have been carried out on the same object. For instance,
they could be the samples taken from two different outcrops. The t–test can
now be used to test the hypothesis that both samples come from the same
population, e.g., the same lithologic unit ( null hypothesis) or from two dif-
ferent populations ( alternative hypothesis). Both, the sample and population
distribution have to be gaussian. The variances of the two sets of measure-
ments should be similar. Then the appropriate test statistic is
2
2
where n and n are the sample sizes, s and s are the variances of the two
a b a b
samples a and b. The alternative hypothesis can be rejected if the measured
t-value is lower than the critical t-value, which depends on the degrees of
freedom Φ=n +n -2 and the signifi cance level α. If this is the case, we can-
b
a
not reject the null hypothesis without another cause. The signifi cance level