How to fit this model with a Weibull distribution?
Mostra commenti meno recenti
Hi. I'm trying to fit my empirical curve with a theoretical Weibull distribution through curve fitting (cftool). The problem is that I get a negative value and I can't understand why.
I tried adding a +c constant to the Weibull function, but it only got worse:
I also tried adjusting the variables' StartingPoint values but nothing changed. I am pretty sure this has to work somehow. Thank you in advance.
2 Commenti
Do you have the original data from which you assume that they follow a Weibull distribution ?
If yes: Apply "mle":
Michele
il 27 Set 2024
Risposta accettata
Più risposte (2)
John D'Errico
il 27 Set 2024
Modificato: John D'Errico
il 27 Set 2024
If this is data that you think comes from a Weibull, then you do not want to use regression techniques to fit the distribution. And adding a constant term invalidates the result as a Weibull distribution.
You can use MLE. But more approprately, use wblfit.
help wblfit
If you provide the data, we can possibly offer more or better advice. Lacking that, just use wblfit.
13 Commenti
Michele
il 27 Set 2024
Your data look as if they follow a uniform distribution on [0 1]. Did you exchange the data from your above plot ?
x = load("distrib.mat");
histogram(x.M_empRel)
Michele
il 27 Set 2024
Torsten
il 27 Set 2024
What are the random values you want to fit a distribution to ? They don't have an x- and and y-value, but are one-dimensional.
Otherwise you have (x/y) data that you want to fit a function to.
Read about the difference between distribution fitting and curve fitting:
Michele
il 27 Set 2024
Michele
il 27 Set 2024
The integral of a Weibull distribution should be 1, yours is appr. 13000. So I think there must be a fundamental misunderstanding about what you are supposed to do with the data.
x = load("x_axis.mat");
y = load("y_axis.mat");
plot(x.t,y.M_empRel)
trapz(x.t,y.M_empRel)
As said, you can't fit your data with a distribution function since the integral of distribution functions from 0 to Inf is 1 whereas yours is appr. 13000.
And I don't understand why the blue curve does not pass through (0/1) if you took exp(-(x/b)^c) as fitting function.
Torsten
il 28 Set 2024
Then why did the exponential fit work?
Because a*exp(b*x) is not a distribution function for arbitrary choices of the parameters a and b.
Besides, what am I supposed to do then to make it work with a Weibull distribution? Scale down my values/data?
It will be difficult with a modified Weibull function because only in a very special case it passes through (0/1).
David Goodmanson
il 27 Set 2024
Modificato: David Goodmanson
il 27 Set 2024
Hi MIchele,
One possibility is that you are not fitting the correct statistical function to the data. The algebraic expression you have is a probability density function (pdf), but the data runs from y = 1 down to y = 0 [eventually], and looks like a cumulative distribution function (cdf), more specifically (1-cdf) since a cdf runs from 0 up to 1. For the weibull cdf,
y = 1-exp(-(x/b)^c) and (1-y) = exp(-(x/b)^c)
and the latter function you can fit to the data.
When x=0 then y=1, and when x=b then y = exp(-1) = .368 for all vaues of c. Looking at your plot, .368 occurs close to x = 1 which implies that b is approximately 1.
I guess another possibility is that y is a pdf that so happens to equal 1 at x = 0. This occurs for the weibull pdf when c = 1, which is the same as the pdf of an exponential distribution, (1/b) exp(-x/b).
3 Commenti
Michele
il 27 Set 2024
David Goodmanson
il 27 Set 2024
I plotted the data you enclosed vs a linear scale and it does not look in the least like the data in the plot.
Michele
il 27 Set 2024
Categorie
Scopri di più su Exploration and Visualization in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!






