Amplitude vs. Height for Gaussian fits

2,145 views
Skip to first unread message

Kelley Commeford

unread,
May 20, 2016, 11:42:53 AM5/20/16
to lmfit-py
Hello!

I am quite new to python in general, and just got lmfit today. I am trying to fit two gaussians to some data, and from the NIST example on the website, this is done by using prefixes. In order to separate the gaussians from each other and give a better fit, it seems you need to specify starting ranges. I've done this, received an ok fit, but I have some questions.

1: What is the difference between height and amplitude of our Gaussians? I've always thought those were synonymous, but the amplitude output and what I need to use as a constraint is nowhere near the height of my peaks. 

2: Is there somewhere that explains what each parameter you can feed the models is? Such as amplitude, height, sigma, FWHM etc, and how it measures such things? I have not been successful finding it on the website. 

3: I don't know what any of the correlation stuff is, but I imagine it may relate to this questions... Is there a way to compare the fit to the data numerically? Like a goodness of fit number? 

Sorry for my lack of statistics/python knowledge. Any help is appreciated.

Kelley

Matt Newville

unread,
May 20, 2016, 12:03:43 PM5/20/16
to Kelley Commeford, lmfit-py
On Fri, May 20, 2016 at 10:42 AM, Kelley Commeford <kelley.c...@gmail.com> wrote:
Hello!

I am quite new to python in general, and just got lmfit today. I am trying to fit two gaussians to some data, and from the NIST example on the website, this is done by using prefixes. In order to separate the gaussians from each other and give a better fit, it seems you need to specify starting ranges. I've done this, received an ok fit, but I have some questions.

1: What is the difference between height and amplitude of our Gaussians? I've always thought those were synonymous, but the amplitude output and what I need to use as a constraint is nowhere near the height of my peaks. 

2: Is there somewhere that explains what each parameter you can feed the models is? Such as amplitude, height, sigma, FWHM etc, and how it measures such things? I have not been successful finding it on the website. 

The definition for the Gaussian function used in lmfit is at  https://lmfit.github.io/lmfit-py/builtin_models.html#gaussianmodel

There you will see that Amplitude means weighting factor multiplying a unit-normalized Gaussian, so that the maximum height at the centroid is Amplitude/(sqrt(2pi)*sigma), and that the full-width at half maximum is  ~2.355 sigma.    In the fit, amplitude, center, and sigma can be varied, while height and fwhm are reported values, derived from these quantities.
 
3: I don't know what any of the correlation stuff is, but I imagine it may relate to this questions... Is there a way to compare the fit to the data numerically? Like a goodness of fit number? 

Yes, the fit result includes chi-square and several other fit statistics, and these will be printed in the fit report.  See http://lmfit.github.io/lmfit-py/fitting.html#goodness-of-fit-statistics

The correlations between pairs of variables describe how changing one variable away from it's best fit value would cause the value of the variable to respond.
 
Hope that helps,

--Matt

Reply all
Reply to author
Forward
0 new messages