Mathematical Approach to Fitting
Let \(F(a,b,c)\) be a function with three free parameters \(a\), \(b\), and \(c\). We want to fit these three parameters to a dataset \(f_{i}\) where \(i\) is the \(i^{th}\) measurement. Whilst the three parameters may be non-linear, we can consider linear least-squares fitting with three simultaneous linear equations, one for each parameter.
We define the partial derivatives of our function:
To determine \(a\), \(b\), and \(c\) for our dataset \(f\), we need to provide initial estimates for the parameters, \(a_0\), \(b_0\), and \(c_0\). We can then calculate the difference between the observations and the initial guess at each spectral pixel \(i\) contained in the observed spectrum.
We invoke Cramer’s Rule (Bevington, 2003) and define the following matrices each describing three simultaneous linear equations.
Now the shift from the initial guesses is given by the following expressions:
The matrices above are re-calculated until \(\Delta a\), \(\Delta b\), and \(\Delta c\) are sufficiently small as to change the values \(a\), \(b\), and \(c\) insignificantly.
In the case of retrieving physical properties from an observed \(\text{H}_3^+\) spectrum, the spectral function is given on the Spectral Function page. In general there are a handful of parameters that can be derived from fitting \(\text{H}_3^+\) spectra:
Temperature, \(T\)
Column integrated \(\text{H}_3^+\) density, \(N\)
Some background function, \(b(\lambda)\)
The width of the emission lines, \(\sigma(\lambda)\)
The offset from rest wavelengths, \(s(\lambda)\)
The last three of these can be expressed as constants or as polynomial functions of wavelength of some order. h3ppy will generate the matricies for any given number of parameters and perform the least squares minimisation to find the best fit.
Uncertainties
If an observed spectrum has \(N\) paris of wavelegth and radiance values, then the standard deviation (\(\mu\)) of a single dependent datum is given by:
where \(\nu\) is the degrees of freedom of the fit and \(S^{\prime} = \sum_{i=0}^N{\eta_i^2}\), so that \(S^\prime \rightarrow S\) as we iterate twoards convergence.
The formal uncertainty (\(\sigma\)), or standard error, of a parameter (e.g., \(a\)) is given by:
where \(|Z_{A,A}|\) is the determinant of the \(\nu - 1\) dimensional matrix formed by removing row \(A\) and column \(A\) from matrix \(Z\). This uncertainty is purely based on the pread of the data.