MATLAB Answers

How do I fit gaussian function to data whose only information I have is the minimum, maximum and number of data points?

2 views (last 30 days)
AAS
AAS on 8 Sep 2020
Commented: Alan Stevens on 9 Sep 2020
I have the minimum, maximum and number of data points. How can I fit a gaussian to this?

  0 Comments

Sign in to comment.

Accepted Answer

Jeff Miller
Jeff Miller on 9 Sep 2020
Mostly I agree with Alan, but I'd say that your guess for the number of standard deviations should not be a constant of 6 but should depend on the number of data points N. In the following, the upper graph shows the expected value of the sample maximum Z score (vertical axis) as a function of the sample size (horizontal axis). On that basis, I'd say you should guess a range of just under +/- 3 sigma for a sample of N=400, because this is the average maximum Z score you would get for a sample of that size. But then drop that down to around +/- 2.5 sigma for N in the vicinity of 100, etc.
But keep in mind that the sample extremes are random variables and so subject to some error, again depending on sample size as shown in the lower graph (variance of the sample maximum as a function of N).
Everything is symmetric of course so the analogous Zmin will have corresponding properties.
Here is the code to do the relevant computations with Cupid, in case you want to check some other N's, prefer looking at median Z's rather than mean Z's, etc.
sampleNs = 10:10:400;
E_max = nan(numel(sampleNs),1);
SD_max = nan(numel(sampleNs),1);
for i=1:numel(sampleNs)
% Make the distribution of the maximum Z score in a sample of the indicated size
thisDist = OrderIID(sampleNs(i),sampleNs(i),Normal(0,1));
E_max(i) = thisDist.Mean;
SD_max(i) = thisDist.SD;
end
figure;
subplot(2,1,1);
plot(sampleNs, E_max)
ylabel('E[Zmax]');
subplot(2,1,2)
plot(sampleNs, SD_max)
xlabel('N')
ylabel('\sigma_{Zmax}')

More Answers (1)

Alan Stevens
Alan Stevens on 8 Sep 2020
All you can reasonably do is assume the maximum and minimum are a certain number of standard deviations ( say 6 sigma) away from the mean ( mu = the average of the minimum and maximum).

  0 Comments

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!