nls
function with the port
algorithm.fit_CWCurve(values,
n.components.max,
fit.failure_threshold = 3,
fit.trace = FALSE,
fit.calcError = FALSE,
LED.power = 36,
LED.wavelength = 470,
log = "",
cex.global = 0.6,
main = "CW-OSL Curve Fit",
sample_code = "Default",
ylab, xlab,
output.path,
output.terminal = TRUE,
output.terminalAdvanced = TRUE,
output.plot = TRUE)
output.terminal = TRUE
.
If output.terminal = FALSE no advanced output is possible.output.path
is set.list
objectnls
object ($fit
) for which generic R functions are provided,
e.g. summary, confint, profile. For more details, see nls.
(b) a data.frame containing the summarized parameters including the
error ($output.table
).The function for the fitting has the general form : $$y = I0_1*exp(-lambda_1*x) + ,\ldots, + I0_i*exp(-lambda_i*x)$$ where $1>= i <= 7$<="" p="">
Start values
Start values are estimated automatically by fitting a linear function on the log input data set. Currently, there is no option to manually provide start parameters.
goodness of fit
The goodness of the fit is given by a expression(pseudo-R^2) 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 confint. Due to considerable calculation time, this option is deactived 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 details on the nonlinear regression in R, see Ritz & Streibig (2008).
=>Ritz, C. & Streibig, J.C., 2008. Nonlinear Regression with R R. Gentleman, K. Hornik, & G. Parmigiani, eds., Springer.
fit_LMCurve
, plot
,nls
##load data
data(ExampleData.CW_OSL_Curve)
##fit data
fit <- fit_CWCurve(values = ExampleData.CW_OSL_Curve,
main = "CW Curve Fit",
n.components.max = 4,
log = "x")
Run the code above in your browser using DataLab