polypredci

버전 1.0.0.0 (4.3 KB) 작성자: Star Strider
POLYPREDCI calculates prediction intervals for ‘polyfit’ and ‘polyval’ curve fits.
다운로드 수: 567
업데이트 날짜: 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 CenterMATLAB Answers에서 Interpolation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0