3
$\begingroup$

This question is more about the appearance of a curve that comes up while I am analysing my data rather than an actual physics question, but I think it's relevant.

I have analysed some data from an EDM experiment and am supposed to be investigating whether or not the data follows a Gaussian distribution. I have used $\chi ^{2}$ and the excel solver add-in to minimise this value and fit the resulting function over my data.

However, when I plot my fit the curve (shown here in oragne) it isn't symmetric. It's pretty close, but not quite. Is this a problem? And if you wouldn't mind, why or why not?

Non Symmetric gaussian fit

$\endgroup$
  • 2
    $\begingroup$ You may need to specify the question better. A Gaussian function is symmetric about it's mean by construction. It can't help it. So, what is the asymmetry that is bothering you? That the mean is not quite zero? That the fit may be underestimating one tail and over estimating the other. That they data simply have some scatter? $\endgroup$ – dmckee Nov 23 '14 at 16:50
  • $\begingroup$ Mind you, with the amount of data that you have all those things are to be expected. $\endgroup$ – dmckee Nov 23 '14 at 16:50
  • $\begingroup$ Honestly, i'm not sure what I do need to worry about... It sounds like you're saying that in a real world situation, my data isn't going to follow a gaussian function, so the fit won't be exactly a gaussian. Is this a consequence of plotting discrete values against something that should be a continuous function? $\endgroup$ – jm22b Nov 23 '14 at 16:55
  • 3
    $\begingroup$ Would Cross Validated be a better home for this question? $\endgroup$ – Qmechanic Nov 23 '14 at 17:05
  • $\begingroup$ Gaussian functions are by definition symmetric. When I inputted my calculated values into the function and plotted, the result is not symmetrical. Does that simply mean that my data does not follow a gaussian distribution (but is obviously somewhat similar)? i.e do certain values when inputted into the gaussian function not return a symmetrical function? Well, excel is the program I have to use and the solver add-in is what my lab script tells me to use, so i'm not going to worry about that too much. $\endgroup$ – jm22b Nov 23 '14 at 17:07
12
$\begingroup$

Here is how I interpret what happened:

You used Excel to compute the coefficients of the Gaussian that best describe the data: mean $\mu$, standard deviation $\sigma$, and magnitude $A$ for a curve

$$Y=Ae^{-(x-\mu)^2/2\sigma^2}$$

Then you evaluated that function at a number of X values. Since the X values are not symmetrical about the calculated mean, you will not see the same value at corresponding points on either side of the origin.

If you know for sure that you want the Gaussian fit in Excel to be symmetrical about X=0, it would suffice to allow Solver to only compute $\sigma$ and $A$, and set $\mu=0$.

It is quite unlikely that the fitted mean of noisy data is exactly zero: usually it is more important to test whether it could be zero: there are various statistical tests available to determine whether a particular set of observations is consistent with a particular null hypothesis (in this case, null hypothesis might be "data comes from a distribution with mean=0", and it doesn't look like your data would be sufficient to dispel that hypothesis).

Following comments on Wolphram jonny's answer, you are asking whether you can conclude that the data is Gaussian distributed. The answer is, "No you can't". It is very hard (some say, impossible) to prove something is true. You can only hope to show you can't prove it's false.

In your example, the null hypothesis would be "the data follows a Gaussian distribution". Your test would be to do a $\chi^2$ test on the fit, and see whether the value of $\chi^2$ is sufficiently small that you can't rule out that it's a Gaussian. For this you look at the p value - if it's less than some cutoff (usually 0.05) you can say (with a tip of the hat to @Henry who proposed more accurate wording):

"If this curve is in fact Gaussian, and I apply this method, I will wrongly claim it is not Gaussian (reject that hypothesis) in less than 5% (whatever p is used) of the time when I should not reject it."

The reason for the convoluted phrasing is, that random sampling from a Gaussian distribution will lead to a distribution that "looks non Gaussian" about 1 in 20 times when you use this cutoff - in other words, the p value actually says "you will get this result about p% of the time when the distribution is Gaussian".

It can be a bit confusing at first. Bottom line - your fit looks fine, don't worry about the asymmetry, continue with your chi squared test.

For my own entertainment I did the above fitting (with some made up data), with the following results:

enter image description here

This is the "normal" view. You can see I have entered X and Y values, and I created a "fit" column which depends on three cells (which I named mu, sigma and A); finally I created an error metric {=SUMSQ(B2:B12-C2:C12)} - note the curly brackets which you get from entering as a "array formula" (ctrl-shift-enter on PC or cmd-shift-enter on Mac). This allows you to compute the entire thing in one cell without creating a separate column with the error values. I then selected the error cell and ran the solver, minimizing cell F6 while changing cells F2:F4:

enter image description here

A closer look at the formulas (use ctrl-backtick to expand formulas in Excel - but note that it does not show the {} of the array formula... one of many bugs, I'm sure):

enter image description here

You can see here that there is a built in function =CHITEST to test the goodness of fit between the data and the Gaussian fit - and it gives a p value that is well above 0.05 so you would not be able to say this data is not normally distributed.

$\endgroup$
2
$\begingroup$

Within the specification I can glean from the question - here is what I would do.

(i) Find the best fit Gaussian - which I am assuming is what you have done.

(ii) Your best fit should return a chi-squared value

You should compare the chi-squared value with critical values of the chi-squared distribution for the appropriate number of degrees of freedom of the fit. Here I would assume you have 3 model parameters for your Gaussian (height/normalisation, width/sigma, and mean/centre), 14 data points and therefore $14-3= 11$ degrees of freedom.

e.g. For 11 d.o.f. you can reject the Gaussian hypothesis with 99% confidence if the chi-squared value exceeds 24.725.

Tables of critical values at: http://www.medcalc.org/manual/chi-square-table.php

(iii) Examine whether the residuals to the fit depend on $x$. If there is a trend in the residuals then although you might get an acceptable chi-squared, the trend is telling you that there is some asymmetry that is not well-fitted by a Gaussian.

Looking at your data, this doesn't seem to be the case.

$\endgroup$
1
$\begingroup$

A gaussian fit is symmetrical by definition, because it is a gaussian. Your orange fit doesnt look like a gaussian, it is not even smooth. I do no think excel had a gaussian fit function (but I dont use excell so cannot tell for sure. You can use other software such as matlab, or likely free ones on the web. Or, just use that data to calculate the parameters of the best fitting gaussian and draw it on excel. Update: I cannot tell what your professor wants, but I the fields that I have worked, when you fit a gaussian, you fit it with a continuous one (the only "real" gaussian). The data can not be symmetric, but the Gaussian will. The actual source of the data can be symmetrical, but just by chance and error your data might not be. now after you fit it with a gaussian, there are tests to tell you if the fit is good and you can blabe the asymmetry to chance, or if your data is not really well described by a Gaussian. But I guess that will be pretty advanced for what you professor wants. I would say (just by eye) that your data firts a Gaussian acceptably well

$\endgroup$
  • 1
    $\begingroup$ I think as drawn it'a a Gaussian evaluated at the X values of the original (data) points, with linear interpolation. Solver in Excel can easily determine the coefficients of best fit - it's quite a powerful nonlinear optimization tool when you know how to use it. $\endgroup$ – Floris Nov 23 '14 at 16:58
  • $\begingroup$ @Floris Oh I see, I didnt realize that, I thought it was somehow made by hand! $\endgroup$ – Wolphram jonny Nov 23 '14 at 17:00
  • $\begingroup$ Hi, I produced the gaussian fit manually, so I suppose it's a set of points along a gaussian fit joined up with straight lines. I am following a lab script, so i'm confident that this is what my instructor was after. The goal here is to determine whether or not the data is gaussian distributed. Obviously, it is supposed to be continuous and I have relatively few measurements, but is the non-symmetric property of my fit to be expected? $\endgroup$ – jm22b Nov 23 '14 at 17:02
  • $\begingroup$ @Floris Yes, this is what I have done $\endgroup$ – jm22b Nov 23 '14 at 17:03
  • $\begingroup$ I update my answer but Floris' is more detailed $\endgroup$ – Wolphram jonny Nov 23 '14 at 17:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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