How to obtain the standard error for each of the fitted parameters

92 ビュー (過去 30 日間)
Boy
Boy 2021 年 2 月 12 日
コメント済み: Boy 2021 年 2 月 13 日
I am using the curvit toolbox of Matlab and I was wondering how can I get the standard error for each of the fitted parameters:a, b, c, and z. Let's say the x and y data points are:
x = [10, 20, 30, 40]
y = [0.1, 0.02, 0.01, 0.001]
you can visuzlize the data points by the code below
plot(x,y,'*')
The x, y data should fit to function below
function [fitresult, gof] = createFit(x, y)
[xData, yData] = prepareCurveData( x, y );
% Set up fittype and options.
ft = fittype( 'a*exp(b/(x-c)^z)', 'independent', 'x', 'dependent', 'y' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.Lower = [0 0 0 0];
opts.StartPoint = [0.001 0.952083907850712 0.7812 2];
opts.Upper = [1 Inf Inf 3];
% Fit model to data.
[fitresult, gof] = fit( xData, yData, ft, opts );
% Plot fit with data.
figure( 'Name', 'untitled fit 1' );
h = plot( fitresult, xData, yData );
legend( h, 'y vs. x', 'untitled fit 1', 'Location', 'NorthEast', 'Interpreter', 'none' );
% Label axes
xlabel( 'x', 'Interpreter', 'none' );
ylabel( 'y', 'Interpreter', 'none' );
grid on
end

回答 (2 件)

Matt J
Matt J 2021 年 2 月 12 日
編集済み: Matt J 2021 年 2 月 12 日
If you're prepared to assume the parameter estimates have Gaussian errors, perhaps you can find the 95% confidence interval width using confint and divide that result by 3.92.
  3 件のコメント
Matt J
Matt J 2021 年 2 月 13 日
The problem is that you have 4 unknown variables and only only 4 data points to estimate them with.
Boy
Boy 2021 年 2 月 13 日
thanks @Matt J

サインインしてコメントする。


Jeff Miller
Jeff Miller 2021 年 2 月 13 日
The notion of a standard error assumes some kind of random sampling. For example, the standard error of your 'b' parameter reflects the variation in b estimates that would be found across from many random samples like the one you have. It isn't really clear from your dataset what is varying randomly, or by how much it varies. You would need that kind of info to get standard error estimates.
  3 件のコメント
Jeff Miller
Jeff Miller 2021 年 2 月 13 日
Yes, in principle. Generate (say) 1000 random samples. Estimate b for each sample. Compute the standard deviation of the 1000 estimated b values. That standard deviation is your estimated "standard error of b". Similarly you get estimates of the other parameters at the same time, and you can look at the correlation (across 1000 samples) between parameter estimates to get a feel for the tradeoffs between parameters. Of course, 10,000 or more is better if you are patient.
Boy
Boy 2021 年 2 月 13 日
@Jeff Miller Ok, thanks

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLinear and Nonlinear Regression についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by