Is there a way to normalizing a probability density function / keep the density values between 0 and 1?
20 ビュー (過去 30 日間)
I am creating a distribution for my data set, so I’m creating a distribution object first then a pdf from the distribution object. I was wondering if there is a way keep my density values between 0 and 1. I understand that despite the density values the curve still integrates to 1 and its no issue but it'd be nice if there was a way to limit the range between 0 and 1.
I've considered dividing my density value by the max density value to get them to be between 0 and 1 but i am afraid that may have some ramifications.
dist_object = fitdist(Test_Data,"Normal");
dist_pdf = pdf(dist_object,Test_Data);
Normal_hist = histfit(Test_Data,20,'normal');
Normal_hist(1).FaceColor = [.8 .8 1];
Jeff Miller 2021 年 11 月 17 日
Dividing by the max density value would have the unfortunate ramification that the resulting function would no longer be a density function because it would no longer integrate to 1.
It is a common misconception that pdf values should be between 0 and 1 like probabilities. As you said, though, the actual requirement for a pdf is that it integrates to one.
その他の回答 (1 件)
Walter Roberson 2021 年 11 月 18 日
You are fitting a normal distribution, which implies infinite extent.
In any case where the standard deviation is greater than 1/sqrt(2*pi) then no element of the pdf will be greater than 1 and no rescale is required. If the standard deviation is smaller than that then the pdf at the location of the mean will be greater than 1 and any rescale will prevent the integral from working. You would need to increase the standard deviation to prevent that.
However, I wonder whether your data is truly sampling an infinite distribution. I have not looked at the data, but when a set of data is involved it is far more common that the situation involves a finite span... and finite spans are incompatible with normal distribution. I would ask whether perhaps you should be looking for a beta distribution instead of a normal distribution.