confidence and prediction bounds -凯发k8网页登录

main content

confidence and prediction bounds

about confidence and prediction bounds

curve fitting toolbox™ software lets you calculate confidence bounds for the fitted coefficients, and prediction bounds for new observations or for the fitted function. additionally, for prediction bounds, you can calculate simultaneous bounds, which take into account all predictor values, or you can calculate nonsimultaneous bounds, which take into account only individual predictor values. the coefficient confidence bounds are presented numerically, while the prediction bounds are displayed graphically and are also available numerically.

the available confidence and prediction bounds are summarized below.

types of confidence and prediction bounds

interval type

description

fitted coefficients

confidence bounds for the fitted coefficients

new observation

prediction bounds for a new observation (response value)

new function

prediction bounds for a new function value

note

prediction bounds are also often described as confidence bounds because you are calculating a confidence interval for a predicted response.

confidence and prediction bounds define the lower and upper values of the associated interval, and define the width of the interval. the width of the interval indicates how uncertain you are about the fitted coefficients, the predicted observation, or the predicted fit. for example, a very wide interval for the fitted coefficients can indicate that you should use more data when fitting before you can say anything very definite about the coefficients.

the bounds are defined with a level of certainty that you specify. the level of certainty is often 95%, but it can be any value such as 90%, 99%, 99.9%, and so on. for example, you might want to take a 5% chance of being incorrect about predicting a new observation. therefore, you would calculate a 95% prediction interval. this interval indicates that you have a 95% chance that the new observation is actually contained within the lower and upper prediction bounds.

confidence bounds on coefficients

the confidence bounds for fitted coefficients are given by

c=b±ts

where b are the coefficients produced by the fit, t depends on the confidence level, and is computed using the inverse of student's t cumulative distribution function, and s is a vector of the diagonal elements from the estimated covariance matrix of the coefficient estimates, (xtx)–1s2. in a linear fit, x is the design matrix, while for a nonlinear fit x is the jacobian of the fitted values with respect to the coefficients. xt is the transpose of x, and s2 is the mean squared error.

the confidence bounds are displayed in the results pane in the curve fitter app using the following format.

p1 = 1.275  (1.113, 1.437)

the fitted value for the coefficient p1 is 1.275, the lower bound is 1.113, the upper bound is 1.437, and the interval width is 0.324. by default, the confidence level for the bounds is 95%.

you can calculate confidence intervals at the command line with the function.

prediction bounds on fits

as mentioned previously, you can calculate prediction bounds for the fitted curve. the prediction is based on an existing fit to the data. additionally, the bounds can be simultaneous and measure the confidence for all predictor values, or they can be nonsimultaneous and measure the confidence only for a single predetermined predictor value. if you are predicting a new observation, nonsimultaneous bounds measure the confidence that the new observation lies within the interval given a single predictor value. simultaneous bounds measure the confidence that a new observation lies within the interval regardless of the predictor value.

bound typeobservationfunctional
simultaneous

y±fs2 xsxt

y±fxsxt

nonsimultaneous

y±ts2 xsxt

y±txsxt

where:

  • s2 is the mean squared error

  • t depends on the confidence level, and is computed using the inverse of student's t cumulative distribution function

  • f depends on the confidence level, and is computed using the inverse of the f cumulative distribution function.

  • s is the covariance matrix of the coefficient estimates, (xtx)–1s2.

  • x is a row vector of the design matrix or jacobian evaluated at a specified predictor value.

you can graphically display prediction bounds using the curve fitter app. in the curve fitter app, you can display nonsimultaneous prediction bounds for new observations. on the curve fitter tab, in the visualization section, select a level of certainty from the prediction bounds list. you can change this level to any value by selecting custom from the list.

you can display numerical prediction bounds of any type at the command line with the function.

to understand the quantities associated with each type of prediction interval, recall that the data, fit, and residuals are related through the formula

data = fit residuals

where the fit and residuals terms are estimates of terms in the formula

data = model random error

suppose you plan to take a new observation at the predictor value xn 1. call the new observation yn 1(xn 1) and the associated error εn 1. then

yn 1(xn 1) = f(xn 1) εn 1

where f(xn 1) is the true but unknown function you want to estimate at xn 1. the likely values for the new observation or for the estimated function are provided by the nonsimultaneous prediction bounds.

if instead you want the likely value of the new observation to be associated with any predictor value, the previous equation becomes

yn 1(x) = f(x) ε

the likely values for this new observation or for the estimated function are provided by the simultaneous prediction bounds.

the types of prediction bounds are summarized below.

types of prediction bounds

type of bound

simultaneous or nonsimultaneous

associated equation

observation

nonsimultaneous

yn 1(xn 1)

simultaneous

yn 1(x), for all x

function

nonsimultaneous

f(xn 1)

simultaneous

f(x), for all x

the nonsimultaneous and simultaneous prediction bounds for a new observation and the fitted function are shown below. each graph contains three curves: the fit, the lower confidence bounds, and the upper confidence bounds. the fit is a single-term exponential to generated data and the bounds reflect a 95% confidence level. note that the intervals associated with a new observation are wider than the fitted function intervals because of the additional uncertainty in predicting a new response value (the curve plus random errors).

plots of different types of bounds

compute prediction intervals

compute and plot observation and functional prediction intervals for a fit to noisy data.

generate noisy data with an exponential trend.

x = (0:0.2:5)';
y = 2*exp(-0.2*x)   0.5*randn(size(x));

fit a curve to the data using a single-term exponential.

fitresult = fit(x,y,'exp1');

compute 95% observation and functional prediction intervals, both simultaneous and nonsimultaneous. nonsimultaneous bounds are for individual elements of x; simultaneous bounds are for all elements of x.

p11 = predint(fitresult,x,0.95,'observation','off');
p12 = predint(fitresult,x,0.95,'observation','on');
p21 = predint(fitresult,x,0.95,'functional','off');
p22 = predint(fitresult,x,0.95,'functional','on');

plot the data, fit, and prediction intervals. observation bounds are wider than functional bounds because they measure the uncertainty of predicting the fitted curve plus the random variation in the new observation.

subplot(2,2,1)
plot(fitresult,x,y), hold on, plot(x,p11,'m--'), xlim([0 5]), ylim([-1 5])
title('nonsimultaneous observation bounds','fontsize',9)
legend off
   
subplot(2,2,2)
plot(fitresult,x,y), hold on, plot(x,p12,'m--'), xlim([0 5]), ylim([-1 5])
title('simultaneous observation bounds','fontsize',9)
legend off
subplot(2,2,3)
plot(fitresult,x,y), hold on, plot(x,p21,'m--'), xlim([0 5]), ylim([-1 5])
title('nonsimultaneous functional bounds','fontsize',9)
legend off
subplot(2,2,4)
plot(fitresult,x,y), hold on, plot(x,p22,'m--'), xlim([0 5]), ylim([-1 5])
title('simultaneous functional bounds','fontsize',9)
legend({'data','fitted curve', 'prediction intervals'},...
       'fontsize',8,'location','northeast')

figure contains 4 axes objects. axes object 1 with title nonsimultaneous observation bounds, xlabel x, ylabel y contains 4 objects of type line. one or more of the lines displays its values using only markers these objects represent data, fitted curve. axes object 2 with title simultaneous observation bounds, xlabel x, ylabel y contains 4 objects of type line. one or more of the lines displays its values using only markers these objects represent data, fitted curve. axes object 3 with title nonsimultaneous functional bounds, xlabel x, ylabel y contains 4 objects of type line. one or more of the lines displays its values using only markers these objects represent data, fitted curve. axes object 4 with title simultaneous functional bounds, xlabel x, ylabel y contains 4 objects of type line. one or more of the lines displays its values using only markers these objects represent data, fitted curve, prediction intervals.

网站地图