Fitting - Stony Brook University
[Pages:27]Fitting
PHY 604: Computational Methods in Physics and Astrophysics II
Fitting Data
We get experimental/observational data as a sequence of times (or positions) and associate values ? N points: (xi, yi) ? Often we have errors in our measurements at each of these values: i for each yi
To understand the trends represented in our data, we want to find a simple functional form that best represents the data--this is the fitting problem
? We'll follow the discussion in Garcia to get a basic feel for the problem (the discussion in Numerical Recipes is quite similar too)
This is a big topic--we'll just look at the basics here
? We'll see that our previous work on linear algebra and root finding comes back into play...
PHY 604: Computational Methods in Physics and Astrophysics II
Fitting Data
We want to fit our data to a function: ? Here, the aj are a set of parameters that we can adjust ? We want to find the optimal set of aj that make Y best represent our
data
The distance between a point and the representative curve is
? Least squares fit minimizes the sum of the squares of all these errors ? With error bars, we weight each distance error by the uncertainty in
that measurement, giving:
PHY 604: Computational Methods in Physics and Astrophysics II
This is what we minimize
Linear Regression
Linear regression: use a line as our model:
? Our fit appears as: ? Finding the parameters requires minimization generates a linear
system to solve
PHY 604: Computational Methods in Physics and Astrophysics II
Linear Regression
Minimization: derivative of 2 with respect to all parameters is zero:
? Define:
PHY 604: Computational Methods in Physics and Astrophysics II
Linear Regression
We then have a linear system: 2 equations + 2 unknowns
? We can solve this analytically
PHY 604: Computational Methods in Physics and Astrophysics II
Goodness of the Fit
Typically, if M is the number of parameters (2 for linear), then N M
? Average pointwise error should be ? Number of degrees of freedom is N - M
i.e. larger M makes it easier to fit all the points See discussion in Numerical Recipes for more details and limitations
? Putting these ideas into the 2 expression suggests that we consider
If this is < 1, then the fit is good But watch out, 1 may also mean our errors were too large to
begin with, we used too many parameters, ...
PHY 604: Computational Methods in Physics and Astrophysics II
Generating Our Experimental Data
We perturb a desired functional form with random number
? The random numbers sample a Gaussian-normalized distribution
numpy.random.randn() in python
Gaussian-normalized distribution matches our expectation of the behavior of experimental error
PHY 604: Computational Methods in Physics and Astrophysics II
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- polynomial regression and regularization
- week 9 polynomial interpolation and least squares
- non linear least squares minimization and curve fitting
- lab 12 polynomial regression and step functions in python
- fitting stony brook university
- polynomial curve fitting
- curve fitting in python
- week 9 polynomial interpolation and least squares fitting
- curve fitting piecewise polynomial interpolation splines
- section 4 2 fitting curves and surfaces by leastsurfaces
Related searches
- screen not fitting monitor
- fitting a polynomial to data
- polynomial fitting excel
- polynomial curve fitting equation
- 1911 barrel lug fitting tool
- brook converter
- fitting a linear model calculator
- polynomial curve fitting matlab
- carbon steel pipe fitting specs
- copper fitting size chart pdf
- doubletree oak brook il
- hilton oak brook il