Documentation

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 Fitting 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 confint 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.

The nonsimultaneous prediction bounds for a new observation at the predictor value x are given by

Pn,o=y^±ts2+xSxT

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, and S is the covariance matrix of the coefficient estimates, (XTX)–1s2. Note that x is defined as a row vector of the design matrix or Jacobian evaluated at a specified predictor value.

The simultaneous prediction bounds for a new observation and for all predictor values are given by

Ps,o=y^±fs2+xSxT

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

The nonsimultaneous prediction bounds for the function at a single predictor value x are given by

Pn,f=y^±txSxT

The simultaneous prediction bounds for the function and for all predictor values are given by

Ps,f=y^±fxSxT

You can graphically display prediction bounds using Curve Fitting app. With Curve Fitting app, you can display nonsimultaneous prediction bounds for new observations with Tools > Prediction Bounds. By default, the confidence level for the bounds is 95%. You can change this level to any value with Tools > Prediction Bounds > Custom.

You can display numerical prediction bounds of any type at the command line with the predint 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 Non-simultaneous

Associated Equation

Observation

Non-simultaneous

yn+1(xn+1)

Simultaneous

yn+1(x), for all x

Function

Non-simultaneous

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).

Prediction Intervals

This example shows how to compute and plot prediction intervals at the command line.

Generate data with an exponential trend:

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

Fit the data using a single-term exponential:

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

Compute prediction intervals:

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:

subplot(2,2,1)
plot(fitresult,x,y), hold on, plot(x,p11,'m--'), xlim([0 5])
title('Nonsimultaneous observation bounds','Color','m')
subplot(2,2,2)
plot(fitresult,x,y), hold on, plot(x,p12,'m--'), xlim([0 5])
title('Simultaneous observation bounds','Color','m')
subplot(2,2,3)
plot(fitresult,x,y), hold on, plot(x,p21,'m--'), xlim([0 5])
title('Nonsimultaneous functional bounds','Color','m')
subplot(2,2,4)
plot(fitresult,x,y), hold on, plot(x,p22,'m--'), xlim([0 5])
title('Simultaneous functional bounds','Color','m')

Was this topic helpful?