How to analyze a distribution parameters?

3 次查看(过去 30 天)
Hi,
I have a distribution of pixels (y) as a function of a parameter (x) where every y value (bin) is the total number of pixels at a given value of x. I'd like to analyze this distribution for mean, median, max, std, etc, and find the corresponding x values for these measurements. Anybody have a way to do this?
Thanks,
Avi
  1 个评论
John D'Errico
John D'Errico 2016-4-2
Please don't indent your paragraphs. That causes the entire paragraph to come out as one long line, which must be scrolled to read it. I removed the indentation for you.

请先登录,再进行评论。

采纳的回答

Roger Stafford
Roger Stafford 2016-4-2
编辑:Roger Stafford 2016-4-2
I fail to see what the difficulty is here. If x is a vector containing all the values of the parameter in question, then y is a vector of all the corresponding pixel counts and y/sum(y) is a vector of the probabilities of each value of x. The mean value of x would then be:
m = sum(x.*y/sum(y))
The standard deviation would be:
s = sqrt(sum((x-m).^2*y/sum(y)))
  3 个评论
Roger Stafford
Roger Stafford 2016-4-2
编辑:Roger Stafford 2016-4-2
@Muhammad: The coefficient of determination would depend on what statistical model you are trying to fit.
@Avigdor: As an addendum to the above answer, here is code for finding the statistical median:
[xs,p] = sort(x);
ys = y(p);
c = cumsum(ys/sum(ys));
f = find(c>=1/2,1,'first');
xmed1 = xs(max(f-1,1));
xmed2 = xs(f);
The statistical median is any number between xmed1 and xmed2.
The max is not a statistical entity. Just use matlab's 'max' function on x.
Muhammad Usman Saleem
@Roger: if i am using mean , mean absolute error, correlation and want to find coefficient of determination in matlab then its formula?

请先登录,再进行评论。

更多回答(1 个)

Image Analyst
Image Analyst 2016-4-2
You can simply do
meany = mean2(y);
mediany = median(y(:));
maxy = max(y(:));
stdDevy = std(y(:));
I don't see how x is involved. Your parameter "x" is basically the gray level and is not involved at all. If you want the range of "x", you can simply do
grayLevelRange = max(y(:)) - min(y(:)) + 1;
  3 个评论
Image Analyst
Image Analyst 2016-4-2
For some arbitrary histogram with bin heights all over the place, no bin will likely have the mean bin count. For example, let's say the bins had counts from 0 to 100,000. And let's say the mean bin height was 23,489.12343. Well, no bin has that since counts must be an integer. So let's say you round to 23,489. Well, there might be 5 or 10 or any number of bins with a count of 23,489. So which one(s) do you want? And why?
Avigdor
Avigdor 2016-4-2
Hi, the distribution is constructed by counting the number of pixels (y) in discrete grey level ranges (x, bins) over a large range of grey values in some images. We want to find the mean, median of the # of pixels, not so much to know the statistics for pixel count (y), but rather the corresponding grey level/bin for these pixel statistics (x). The distributions are unimodal, and we need the grey level distribution statistics because they relate to some physical parameter of interest. Thanks!

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by