Fitting function
The function for the fitting has the general
form:
$$y = (exp(0.5) * Im_1 * x / xm_1) * exp(-x^2 / (2 * xm_1^2)) + \ldots +
exp(0.5) * Im_i * x / xm_i) * exp(-x^2 / (2 * xm_i^2))$$
where \(1 < i < 8\)
This function and the equations for the conversion to b (detrapping probability)
and n0 (proportional to initially trapped charge) have been taken from Kitis
et al. (2008):
$$xm_i=\sqrt{max(t)/b_i}$$
$$Im_i=exp(-0.5)n0/xm_i$$
Background subtraction
When a background signal is provided with the values.bg argument, the
user can choose among three methods for background subtraction by setting
the bg.subtraction argument to one of these:
"polynomial" (default): a polynomial function is fitted using glm
and the resulting function is used for background subtraction:
$$y = a*x^4 + b*x^3 + c*x^2 + d*x + e$$
"linear": a linear function is fitted using glm and the resulting
function is used for background subtraction:
$$y = a*x + b$$
"channel": the measured background signal is subtracted channel-wise
from the measured signal.
"none": this disables background subtraction even if values.bg is
provided.
Start values
The choice of the initial parameters for the nls-fitting is a crucial
point and the fitting procedure may mainly fail due to ill chosen start
parameters. Here, three options are provided:
(a)
If start_values is not provided by the user, a cheap guess is made
by using the detrapping values found by Jain et al. (2003) for quartz for a
maximum of 7 components. Based on these values, the pseudo start parameters
xm and Im are recalculated for the given data set. In all cases, fitting
starts with the ultra-fast component and (depending on n.components)
steps through the following values. If no fit could be achieved, an error
plot (for plot = TRUE) with the pseudo curve (based on the
pseudo start parameters) is provided. This may give the opportunity to
identify appropriate start parameters visually.
(b)
If start values are provided, the function works like a simple nls
fitting approach.
Goodness of fit
The goodness of the fit is given by a pseudo-R² value (pseudo coefficient of
determination). According to Lave (1970), the value is calculated as:
$$pseudoR^2 = 1 - RSS/TSS$$
where \(RSS = Residual~Sum~of~Squares\)
and \(TSS = Total~Sum~of~Squares\)
Error of fitted component parameters
The 1-sigma error for the components is calculated using
the function stats::confint. Due to considerable calculation time, this
option is disabled by default. In addition, the error for the components
can be estimated by using internal R functions like summary. See the
nls help page for more information.
For more details on the nonlinear regression in R, see Ritz & Streibig (2008).