Analysis 5: Difference between revisions
No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
<math> c_i = A \exp(-(e_i-B)^2/(2 C^2)) + D^x + E </math> | <math> c_i = A \exp(-(e_i-B)^2/(2 C^2)) + D^x + E </math> | ||
Data for non-linear model and confidence interval example: [[media:counts.txt]]; Code (change sufixx to .py) [[media:Nonlinear_model.txt]]; Output [[media:Data_nonlinear.png]], [[media:Counts_with_fit.png]], [[media:Confidence_peak_constant_background.png]] | Note that this model is nonlinear because there is an exponential -- presumably modeling some line in the data. Because this is count data, we can use Poisson statistics to estimate the variance of the data: the variance of <math>c_i</math> is just <math>c_i</math>. | ||
Data for non-linear model and confidence interval example: [[media:counts.txt]]; | |||
Code (change sufixx to .py) [[media:Nonlinear_model.txt]]; Output [[media:Data_nonlinear.png]], [[media:Counts_with_fit.png]], [[media:Confidence_peak_constant_background.png]] |
Revision as of 00:51, 11 February 2012
In the past few tutorials, you learned how to fit data using a linear model. While many datasets may be fit with such a model, other datasets, including some that you encounter in the lab course, will not be described by linear models. Remember that a model is linear if it is linear in the parameters, so a nonlinear model must be nonlinear in the parametes. Here we introduce some data <math>c_i</math> representing, say, the number of gamma-rays incident on a detector. These data are sorted by their energy <math>e_i</math>. We model the counts as a function of their energy:
<math> c_i = A \exp(-(e_i-B)^2/(2 C^2)) + D^x + E </math>
Note that this model is nonlinear because there is an exponential -- presumably modeling some line in the data. Because this is count data, we can use Poisson statistics to estimate the variance of the data: the variance of <math>c_i</math> is just <math>c_i</math>.
Data for non-linear model and confidence interval example: media:counts.txt;
Code (change sufixx to .py) media:Nonlinear_model.txt; Output media:Data_nonlinear.png, media:Counts_with_fit.png, media:Confidence_peak_constant_background.png