Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have been given a set of data points. How can I find the best fit of the form $$\frac{1}{\sqrt{2\pi}\sigma}e^{-\frac{(x-\mu)^2}{\sigma^2}}?$$ Even better if Sage can do it. And how can I approximate how good the fit is?

share|improve this question
    
Is this homework? –  Simon Hayward Nov 3 '12 at 10:42
    
At least for me it is not a homework. Another person asked me that. –  student Nov 3 '12 at 10:46
    
Yes, it is because this seems like a very common homework question, which is absolutely fine, just that it should be marked as such if it is. –  Simon Hayward Nov 3 '12 at 11:13
1  
The original author wanted to find a software to do such fitting. I found the question interesting as I had never met such a problem. But now I learned that I can use $\chi^2$-test to measure how good solution is and found that Sage will do the job for me, ask.sagemath.org/question/1164/gauss-distribution-fit . –  student Nov 3 '12 at 11:29
    
You may want to put your comment here where you found the computation as an answer, so that people see it more readily! –  kcrisman Jun 26 at 3:12

2 Answers 2

up vote 1 down vote accepted

The best fit is given by finding the sample mean $\overline{x}$ and putting this in place of the population mean $\mu$ in the distribution function. Then you find the sample variance $\hat{s}^2$ and substitute for $\sigma^2$ in the distribution function.

You can then use the $\chi^2$ goodness of fit test to determine whether the fit is a good one or not.

I wouldn't know about doing this in Sage, although there is a tutorial here:-

http://www.sagemath.org/doc/reference/sage/gsl/probability_distribution.html

Some info on goodness of fit with link to further resources is on wikipedia:-

https://en.wikipedia.org/wiki/Goodness_of_fit

Shout if anything is unclear.

share|improve this answer

I think the good point to start is Normality test where you can find few approaches to test the data Graphical methods, Back-of-the-envelope test, Frequentist testsBayesian tests.

I assume that Sage should have package with Shapiro-Wilk Test for Normality.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.