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

31 views (last 30 days)
Rohit Sinha on 8 Jun 2022
Commented: Sam Chak on 8 Jun 2022
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 on 8 Jun 2022
Edited: Sam Chak on 8 Jun 2022
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
rmse: 0.0476
plot(myfit, x, prob)
Sam Chak on 8 Jun 2022
@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.