polypredci

POLYPREDCI calculates prediction intervals for ‘polyfit’ and ‘polyval’ curve fits.
ダウンロード: 559
更新 2016/6/11

ライセンスの表示

POLYPREDCI takes the actual (x,y) data and polynomial order as arguments, uses ‘polyfit’ and ‘polyval’ to do the regression, then calculates and returns the fitted curve and the one-sided prediction confidence intervals on the fit. It uses the one-tailed t-statistic to calculate the confidence intervals. That calculation is entirely contained within POLYPREDCI, so the Statistics and Machine Learning Toolbox is not required. (It does not calculate confidence intervals for the parameters. See the related function ‘polyparci’ for that.) It is extensively internally documented.

POLYPREDCI follows published equations (in several references) to calculate the confidence intervals. They are close to but not the same as those calculated by ‘nlpredci’. I have no idea how ‘nlpredci’ calculates its confidence intervals, since they do not appear in the documentation that I can find.

POLYPREDCI has three required arguments and two optional arguments. The three required arguments are: ‘x’ (the independent data vector), ‘y’ (the dependent data vector), and ‘n’ (the polynomial order). The two optional arguments are ‘alfa’ (the desired level of statistical significance), and ‘xv’ (high-resolution vector for polynomial fit and confidence interval calculations). The default value for ‘alfa’ is 0.95.

POLYPREDCI was stimulated by a Question from ‘pocketHands’ on 2016 06 10, who thought ‘polyparci’ would do this. (It won’t!)

POLYPREDCI was created with R2016a but should work on all recent releases.

Example on using POLYPREDCI:

x = linspace(0, 2.5, 15); % Create Data
y = 2 + 3*x.^2 + 5*randn(size(x)); % Create Data

n = 3; % Polynomial Order
alfa = 0.99; % Desired Significance
xv = linspace(min(x), max(x))'; % Optional High-Resolution Vector
[ p, yhat, ci ] = polypredci( x, y, n, alfa, xv ); % Define Both ‘alfa’ & ‘xv’
% [ p, yhat, ci ] = polypredci( x, y, n, alfa ); % Use ‘alfa’
% [ p, yhat, ci ] = polypredci( x, y, n ); % Use Defaults

figure(1)
plot(x, y, 'bp')
hold on
if length(yhat) == length(x)
plot(x, yhat, '--r')
plot(x, yhat+ci, '--g')
plot(x, yhat-ci, '--g')
elseif length(yhat) == length(xv)
plot(xv, yhat, '--r')
plot(xv, yhat+ci, '--g')
plot(xv, yhat-ci, '--g')
end
hold off
grid

引用

Star Strider (2024). polypredci (https://www.mathworks.com/matlabcentral/fileexchange/57630-polypredci), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2016a
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersInterpolation についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
バージョン 公開済み リリース ノート
1.0.0.0