![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/358072/image.jpeg)
How do I fit gaussian function to data whose only information I have is the minimum, maximum and number of data points?
2 次查看(过去 30 天)
显示 更早的评论
I have the minimum, maximum and number of data points. How can I fit a gaussian to this?
0 个评论
采纳的回答
Jeff Miller
2020-9-9
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.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/358072/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/358072/image.jpeg)
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}')
更多回答(1 个)
Alan Stevens
2020-9-8
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 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!