2
$\begingroup$

I have run Shapiro-Wilk normality test on an 80 value sample and the output was a p-value of 0.001137.

Now I would like to know what are the parameters of the gaussian function that best describes my sample. How can I do it?

$\endgroup$

1 Answer 1

2
$\begingroup$

I might be misunderstanding but such a $p$ value might be suggesting the data may not be normal (e.g. see here or here).

But, in any case, if you want to fit a Gaussian distribution to the data $\{x_k\}_{j=1}^n$, the easiest way is estimate the mean and variance by $$ \bar{x}=\frac{1}{n}\sum_i x_i\;\;\;\;\&\;\;\;\;s^2=\frac{1}{n-1}\sum_i (x_i-\bar{x})^2 $$ and use the normal distribution $\mathcal{N}(\bar{x},s^2)$.

$\endgroup$
2
  • $\begingroup$ You are right. I terribly misunderstood Shapiro-Wilk test. However, is this the only way to fit a gaussian distribution to data ? I have heard that there are other methods that are "more precise". $\endgroup$
    – Mohamed7
    Commented May 29, 2017 at 13:43
  • 1
    $\begingroup$ @Mohamed7 For a single Gaussian, I'm not sure you can really do much better than this (let me know if you find a way to do so). But, for harder distributions (like Gaussian mixture models) it can be better to do, say, EM. $\endgroup$ Commented May 29, 2017 at 14:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .