Geoscience Reference
In-Depth Information
Instead of using the equation for the regression line we can also use the
function polyval to calculate the y -values.
plot(meters,age,'o'), hold on
plot(meters,polyval(p,meters),'r'), hold off
Both of the functions polyfit and polyval are incorporated in the GUI
function polytool .
Movie
4.1
polytool(meters,age)
h e coei cients p(x) and the equation obtained by linear regression can
now be used to predict y -values for any given x -value. However, we can only
do this within the depth interval for which the linear model was i tted, i.e.,
between 0 and 20 meters. As an example the age of the sediment at a depth
of 17 meters is given by
polyval(p,17)
ans =
112.9946
h is result suggests that the sediment at 17 meters depth has an age of ca.
113 kyrs. h e goodness-of-i t of the linear model can be determined by
calculating error bounds. h ese are obtained by using an additional output
parameter s from polyfit as an input parameter for polyconf to calculate the
95% ( alpha =0.05) prediction intervals.
[p,s] = polyfit(meters,age,1);
[p_age,delta] = polyconf(p,meters,s,'alpha',0.05);
plot(meters,age,'o',meters,p_age,'g-',...
meters,p_age+delta,'r--',meters,p_age-delta,'r--')
axis([0 20 0 140]), grid on
xlabel('Depth in Sediment (meters)')
ylabel('Age of Sediment (kyrs)')
h e variable delta provides an estimate for the standard deviation of the
error in predicting a future observation at x by using p(x) . Since the plot
statement does not i t on one line we use an ellipsis (three periods, i.e., ... )
followed by return or enter to indicate that the statement continues on the
next line. h e plot now shows the data points, and also the regression line
and the error bounds of the regression (Fig. 4.5). h is graph already provides
some valuable information on the quality of the result. However, in many
cases a better understanding of the validity of the model is required and
more sophisticated methods for testing the coni dence in the results are
therefore introduced in the following sections.
Search WWH ::




Custom Search