Statistics Toolbox | ![]() ![]() |
Polynomial evaluation and confidence interval estimation
Syntax
Description
uses the optional output [Y,DELTA] = polyconf(p,X,S)
S
generated by polyfit
to give 95% confidence intervals Y
± DELTA
. This assumes the errors in the data input to polyfit
are independent normal with constant variance.
[Y,DELTA] = polyconf(p,X,S,alpha)
gives 100(1-alpha)
% confidence intervals. For example, alpha
= 0.1
yields 90% intervals.
If p
is a vector whose elements are the coefficients of a polynomial in descending powers, such as those output from polyfit
, then polyconf(p,X)
is the value of the polynomial evaluated at X
. If X is a matrix or vector, the polynomial is evaluated at each of the elements.
Examples
This example gives predictions and 90% confidence intervals for computing time for LU factorizations of square matrices with 100 to 200 columns.
n = [100 100:20:200]; for i = n A = rand(i,i); tic B = lu(A); t(ceil((i-80)/20)) = toc; end [p,S] = polyfit(n(2:7),t,3); [time,delta_t] = polyconf(p,n(2:7),S,0.1) time = 0.0829 0.1476 0.2277 0.3375 0.4912 0.7032 delta_t = 0.0064 0.0057 0.0055 0.0055 0.0057 0.0064
![]() | poisstat | polyfit | ![]() |