Performs optimization of (possibly multidataset) models and outputs plots and files representing the fit of the model to the data.
1 2 
data 
list of objects of class 
modspec 
list whose elements are models of class 
datasetind 
vector that has the same length as 
modeldiffs 
list whose elements specify any datasetspecific model differences.

opt 
Object of class 
lprogress 
Logical specifying whether textual output of fitting progress is returned 
This function applies the nls
function internally to
optimize nonlinear parameters and to solve for conditionally linear parameters
(clp) via the partitioned variable projection algorithm.
A list is returned containing the following elements:
currTheta is a list of objects
of class theta
whose elements contain the parameter estimates
associated with each dataset modeled.
currModel is an object of class multimodel
containing the results of fitting as well as the model
specification
toPlotter is a list containing all arguments used by the plotting
function; it is used to regenerate plots and other output by the
examineFit
function
nlsprogress if lprogress = TRUE textual output of the fitting progress is returned as an array of strings
Katharine M. Mullen, Ivo H. M. van Stokkum
Mullen KM, van Stokkum IHM (2007). “TIMP: an R package for modeling multiway spectroscopic measurements.” Journal of Statistical Software, 18(3). http://www.jstatsoft.org/v18/i03/.
readData
, initModel
,
examineFit
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31  ## 2 simulated concentration profiles in time
C < matrix(nrow = 51, ncol = 2)
k < c(.5, 1)
t < seq(0, 2, by = 2/50)
C[, 1] < exp(  k[1] * t)
C[, 2] < exp(  k[2] * t)
## 2 simulated spectra in wavelength
E < matrix(nrow = 51, ncol = 2)
wavenum < seq(18000,28000, by=200)
location < c(25000, 20000)
delta < c(5000, 7000)
amp < c(1, 2)
E[, 1] < amp[1] * exp(  log(2) * (2 * (wavenum  location[1])/delta[1])^2)
E[, 2] < amp[2] * exp(  log(2) * (2 * (wavenum  location[2])/delta[2])^2)
## simulated timeresolved spectra
sigma < .001
Psi_q < C %*% t(E) + sigma * rnorm(nrow(C) * nrow(E))
## as an object of class dat
Psi_q_data < dat(psi.df = Psi_q, x = t, nt = length(t), x2 = wavenum, nl =
length(wavenum))
## model for the data in the timedomain
kinetic_model < initModel(mod_type = "kin", seqmod = FALSE,
kinpar = c(.1, 2))
## fit the model
kinetic_fit < fitModel(data = list(Psi_q_data),
modspec = list(kinetic_model), opt = kinopt(iter=4, plot=FALSE))

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.