Geoscience Reference
In-Depth Information
h e regression line passes through the data centroid dei ned by the sample
means, and we can therefore compute the other regression coei cient b 0 ,
using the univariate sample means and the slope b 1 computed earlier.
As an example let us again load the synthetic age-depth data from the
i le agedepth_1.txt . We can dei ne two new variables, meters and age , and
generate a scatter plot of the data.
clear
agedepth = load('agedepth_1.txt');
meters = agedepth(:,1);
age = agedepth(:,2);
A signii cant linear trend in the bivariate scatter plot, together with
a correlation coei cient greater than r =0.9, suggests a strong linear
dependence between meters and age . In geological terms, this implies that
the sedimentation rate was constant through time. We now try to i t a linear
model to the data that will help us predict the age of the sediment at levels for
which we have no age data. h e function polyfit computes the coei cients
of a polynomial p ( x ) of a specii c degree that i ts the data y in a least-squared
sense. In our example we i t a i rst degree (linear) polynomial to the data
p = polyfit(meters,age,1)
p =
5.3667 21.7607
where p is a row vector containing the polynomial coei cients in descending
powers. Since we are working with synthetic data we know the values for
the slope and the intercept with the y -axis. h e estimated slope (5.3667) and
the intercept with the y -axis (21.7607) are in good agreement with the true
values of 5.6 and 20, respectively. Both the data and the i tted line can be
plotted on the same graph.
plot(meters,age,'o'), hold on
plot(meters,p(1)*meters+p(2),'r'), hold off
Search WWH ::




Custom Search