dat-class {TIMP} | R Documentation |
Class "dat" for model and data storage
Description
dat
is the super-class of other classes representing models and data, so
that other model/data classes (e.g., kin
and spec
for kinetic and spectral
models respectively) also have the slots defined here. Slots whose
description are marked with *** may
be specified in the ...
argument of the initModel
function.
Objects from the Class
Objects from the class
can be created by calls of the form new("dat", ...)
or
dat(...)
, but
most are most often made by invoking another function such as
readData
or initModel
.
Slots
- chinde
- clinde
- clpequspecBD
- cohcol
- compnames
- highcon
- lowcon
- lscalpar
thetascal
:*** Object of class
"vector"
vector of values to scale the parameter vector with.- mvecind
- nvecind
- outMat
- satMat
- usecompnames0
- usecompnamesequ
- weightList
- getX
- getXsuper
weightpar
:*** Object of class
"list"
list of vectorsc(first_x, last_x, first_x2, last_x2, weight)
, where each vector is of length 5 and specifies an interval in which to weight the data.first_x: first(absolute, not an index)
x
to weightlast_x: last (absolute, not an index)
x
to weightfirst_x2: first (absolute, not an index)
x2
to weightlast_x2: last (absolute, not an index)
x2
to weightweight: numeric by which to weight data
Note that if vector elements 1-4 are
NA
(not a number), the firstmost point of the data is taken for elements 1 and 3, and the lastmost points are taken for 2 and 4. For example,weightpar = list(c(40, 1500, 400, 600, .9), c(NA, NA, 700, 800, .1))
will weight data between times 40 and 1500 picoseconds and 700 and 800 wavelengths by .9, and will weight data at all times between wavelength 700 and 800 by .1. Note also that for single photon counting dataweightpar = list(poisson = TRUE)
will apply poisson weighting to all non-zero elements of the data.mod_type
:*** Object of class
"character"
character string defining the model type, e.g.,"kin"
or"spec"
fixed
:*** Object of class
"list"
list of lists or vectors giving the parameter values to fix (at their starting values) during optimization.free
:*** Object of class
"list"
list of lists or vectors giving the parameter values to free during optimization; if this list is present then all parameters not specified in it are fixed, e.g.,free = list(irfpar = 2)
will fix every parameter at its starting value except for the 2ndirfpar
. Iffix = list(none=TRUE)
(or if the elementnone
has length greater than 0) then all parameters in the model are fixed. Note that this option only should be applied to multiexperiment models in which at least one parameter applying to some other dataset is optimized (nls
always must have at least one parameter to optimize).constrained
:*** Object of class
"list"
list whose elements are lists containing a character vectorwhat
, a vectorind
, and either (but not both) a character vectorlow
andhigh
.what
should specify the parameter type to constrain.ind
should give the index of the parameter to be constrained, e.g.,1
if indexing into a vector, andc(1,2)
if indexing into a list.low
gives a number that the parameter should always remain lower than andhigh
gives a number that the parameter should always remain higher than (so thatlow
bounds the parameter value from above andhigh
bounds the parameter value from below). It is not now possible to specify bothlow
andhigh
for a single parameter value. An example of a completeconstrained
specification isconstrained = list(list(what = "kinpar", ind = 2, low = .3), list(what = "parmu", ind = c(1,1), high = .002))
clp0
:*** Object of class
"list"
list of lists with elementslow
,high
andcomp
, specifying the least value inx2
to constrain to zero, the greatest value inx2
to constrain to zero, and the component to which to apply the zero constraint, respectively. e.g.,clp0 = list(list(low=400, high = 600, comp=2), list(low = 600, high = 650, comp=4))
applies zero constraints to the spectra associated with components 2 and 4.autoclp0
:*** Object of class
"list"
that has two elements;oldRes
, the output offitModel
and an indexind
representing the index of the dataset to use inoldRes
;ind
defaults to one. The clp that are negative inoldRes
are constrained to zero in the new model; this is primarily useful when fitting a model, finding some negative clp, and constraining them to zero by fitting again with this option. See also the help page foropt
for other ways to constrain the clp to non-negativity.clpequspec
:*** Object of class
"list"
list of lists each of which has elementsto, from, low, high
, and optional elementdataset
to specify the dataset from which to get the reference clp (that is, a spectrum for kinetic models).to
is the component to be fixed in relation to some other component; from is the reference component.low
andhigh
are the least and greatest absolute values of theclp
vector to constrain. e.g.,clpequspec = list(list(low = 400, high = 600, to = 1, from = 2))
will constrain the first component to equality to the second component between wavelengths 400 and 600. Note that equality constraints are actually constraints to a linear relationship. For each of the equality constraints specified as a list in theclpequspec
list, specify a starting value parameterizing this linear relation in the vectorclpequ
; if true equality is desired then fix the corresponding parameter inclpequ
to 1. Note that if multiple components are constrained, thefrom
in the sublists should be increasing order, (i.e.,(list(to=2, from=1, low=100, high=10000), list(to=3, from=1, low=10000, high=100))
, notlist(to=3, from=1, low=10000, high=100), list(to=2, from=1, low=10000, high=100)
)clpequ
:***Object of class
"vector"
describes the parameters governing the clp equality constraints specified inclpequspec
prelspec
:*** Object of class
"list"
list of lists to specify the functional relationship between parameters, each of which has elementswhat1character string describing the parameter type to relate, e.g.,
"kinpar"
what2the parameter type on which the relation is based; usually the same as
what1
ind1index into
what1
ind2index into
what2
relcharacter string, optional argument to specify functional relation type, by default linear
e.g.,
prelspec = list(list(what1 = "kinpar", what2 = "kinpar", ind1 = 1, ind2 = 5))
relates the 1st element ofkinpar
to the 5th element ofkinpar
. The starting values parameterizing the relationship are given in theprel
vectorpositivepar
:*** Object of class
"vector"
containing character strings of those parameter vectors to constrain to positivity, e.g.,positivepar=c("kinpar")
weight
:Object of class
"logical"
TRUE
when the specification inweightpar
is to be applied andFALSE
otherwisepsi.df
:Object of class
"matrix"
dataset from 1 experimentpsi.weight
:Object of class
"matrix"
weighted dataset from 1 experimentx
:Object of class
"vector"
time or other independent variable.nt
:Object of class
"integer"
lengthx
x2
:Object of class
"vector"
vector of points in 2nd independent dimension, such as wavelengths of wavenumbersnl
:Object of class
"integer"
lengthx2
C2
:Object of class
"matrix"
concentration matrix for simulated dataE2
:Object of class
"matrix"
matrix of spectra for simulated datasigma
:Object of class
"numeric"
noise level in simulated dataparnames
:Object of class
"vector"
vector of parameter names, used internallysimdata
:Object of class
"logical"
logical that isTRUE
if the data is simulated,FALSE
otherwise; will determine whether values inC2
andE2
are plotted with resultsweightM
:Object of class
"matrix"
weightsweightsmooth
:Object of class
"list"
type of smoothing to apply with weighting; not currently usedmakeps
:Object of class
"character"
specifies the prefix of files written to postscriptlclp0
:Object of class
"logical"
TRUE
if specification inclp0
is to be applied andFALSE
otherwiselclpequ
:Object of class
"logical"
TRUE
if specification in clpequspec is to be applied andFALSE
otherwisetitle
:Object of class
"character"
displayed on output plotsmhist
:Object of class
"list"
list describing fitting historydatCall
:Object of class
"list"
list of calls to functionsdscal
:Object of class
"list"
dscalspec
:Object of class
"list"
dummy
:Object of class
"list"
containing dummy parametersdrel
:Object of class
"vector"
vector of starting parameters for dataset scaling relationsscalx
:Object of class
"numeric"
numeric by which to scale thex
axis in plotting- prel
vector of starting values for the relations described in prelspec
fvecind
:Object of class
"vector"
vector containing indices of fixed parameterspvecind
:Object of class
"vector"
used internally to store indices of related parameters.iter
:Object of class
"numeric"
describing the number of iterations that is run; this is sometimes stored after fitting, but has not effect as an argument toinitModel
clpCon
:Object of class
"list"
used internally to enforce constraints on the clpncomp
:Object of class
"numeric"
describing the number of components in a modelclpdep
:Object of class
"logical"
describing whether a model is dependent on the index ofx2
inten
:Object of class
"matrix"
for use with FLIM data; represents the number of photons per pixel measured over the course of all times $t$ represented by the dataset. See the help for thereadData
function for more information.datafile
:Object of class
"character"
containing the name of a datafile associated with thepsi.df
clpType
:Object of class
"character"
that is "nt" if the model has clp in the "x" dimension and "nl" otherwise (so that, e.g., ifmod\_type = "kin"
, thenclpType = "nl"
).
Author(s)
Katharine M. Mullen, Ivo H. M. van Stokkum, Joris J. Snellenburg, Sergey P. Laptenok
See Also
Examples
# simulate data
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)
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)
sigma <- .001
Psi_q <- C %*% t(E) + sigma * rnorm(nrow(C) * nrow(E))
# initialize an object of class dat
Psi_q_data <- dat(psi.df = Psi_q, x = t, nt = length(t),
x2 = wavenum, nl = length(wavenum))
# initialize an object of class dat via initModel
# this dat object is also a kin object
kinetic_model <- initModel(mod_type = "kin", seqmod = FALSE,
kinpar = c(.1, 2))