How to fit a cumulative normal distribution into a smooth curve?

19 次查看(过去 30 天)
I have computed the normal cumulative distribution values for a certain set of data. The data is as follows:
x = [0.005 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4];
prob = [0.0000 0.0000 0.0000 0.0000 0.0000 0.0002 0.0007 0.0018 0.0041 0.0080 0.0138 0.2011 0.4663 0.6518 0.8110 0.9028 0.9470 0.9728 0.9851 0.9920 0.9963 0.9975 0.9983 0.9990];
where prob contains the probability of failure at corresponding value of x already obtained using normcdf on the reliability index.
I want to make a smooth CDF using this data (prob vs x) by passing this data to a function. How do I do it?
I've already used a function available at https://in.mathworks.com/matlabcentral/answers/345595-fitting-cumulative-normal-distribution-function-to-data but using this is leading to a problem that even though the first probability values are zero, the fit does not start from zero. I'm in need of something similar

采纳的回答

Sam Chak
Sam Chak 2022-6-8
编辑:Sam Chak 2022-6-8
The Error function is essentially identical to the standard normal cumulative distribution function, and so I attempted to fit the Error function to the data, with the aim to connect as many points as possible.
myfittype = fittype('0.5*erf(6.6*(x - c)) + 0.5',...
'dependent', {'prob'}, 'independent', {'x'},...
'coefficients', {'c'})
[myfit, gof] = fit(x', prob', myfittype)
which produces
myfit =
General model:
myfit(x) = 0.5*erf(6.6*(x - c)) + 0.5
Coefficients (with 95% confidence bounds):
c = 0.3302 (0.3111, 0.3493)
gof =
struct with fields:
sse: 0.0520
rsquare: 0.9895
dfe: 23
adjrsquare: 0.9895
rmse: 0.0476
plot(myfit, x, prob)
  6 个评论
Rohit Sinha
Rohit Sinha 2022-6-8
编辑:Rohit Sinha 2022-6-8
@Sam Chak, yes, all my data is bounded between 0 and 1. However, 0.5*erf(b*(x - c)) + 0.5 results in the line take an offset from 0. That means, the fit does not start from 0 but a significant (visible) distance above it. Hoever I believe, as you say, playing with the value of 'b' must do the trick. Thanks a lot
Sam Chak
Sam Chak 2022-6-8
@Rohit Sinha, I have not seen all your data. And I hope you understand that the CDF (aka biased Error function) only achieves true 0 at .
By manipulating the b value, you can practically shape the curve you want to fit as many data points as possible.
You will need some time to explore which CDF/Error function model fits the data set. If my Answer solves your original problem and you gain something useful and knowledge from my Comments, please support by voting and accept it.
We can still continue with the discussion, if you are still interested to fit all 6 data sets.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Spline Postprocessing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by