dat-class {TIMP} | R Documentation |
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
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
.
weightpar
:"list"
list of vectors
c(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.
x
to weightx
to weightx2
to weightx2
to weight
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 data
weightpar = list(poisson = TRUE)
will apply poisson weighting to all
non-zero elements of the data.
mod_type
:"character"
character string defining the model type, e.g.,
"kin"
or "spec"
fixed
:"list"
list of lists or vectors giving the parameter values
to fix (at their starting values) during optimization. free
:"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 2nd irfpar
. If
fix = list(none=TRUE)
(or if the element none
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 appling to some other dataset is optimized (nls
always must
have at least one parameter to optimize). constrained
:"list"
list whose elements
are lists containing a character vector what
, a vector ind
, and
either (but not both) a character vector low
and high
.
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, and c(1,2)
if indexing into a list.
low
gives a number that the parameter should always remain lower
than and high
gives a number that the parameter should always remain
higher than (so that low
bounds the parameter value from above and
high
bounds the parameter value from below). It is not now possible to
specify both low
and high
for a single parameter value. An
example of a complete constrained
specification is
constrained = list(list(what = "kinpar", ind = 2, low = .3),
list(what = "parmu", ind = c(1,1), high = .002))
clp0
:"list"
list of lists with elements low
, high
and
comp
, specifying the least value in x2
to constrain
to zero, the greatest value in x2
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
:"list"
that has two
elements; oldRes
,
the output of fitModel
and an index ind
representing the
index of the dataset to use in oldRes
; ind
defaults to
one. The clp that are negative in oldRes
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 for opt
for
other ways to constrain the clp to non-negativity.
clpequspec
:"list"
list of lists each of which has elements to,
from, low, high
, and optional element dataset
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
and high
are the
least and greatest absolute values of the clp
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 specfied as a list in the clpequspec
list, specify a
starting value parameterizing this linear relation in the vector
clpequ
; if true equality is desired then fix the corresponding
parameter in clpequ
to 1. Note that if multiple components are
constrainted, the from
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))
, not list(to=3, from=1, low=10000, high=100),
list(to=2, from=1, low=10000, high=100)
)clpequ
:"vector"
describes the
parameters governing the clp equality constraints specified in clpequspec
prel
:"vector"
vector of starting values for the relations described in
prelspecprelspec
:"list"
list of lists to specify the functional
relationship between parameters, each of which has elements
"kinpar"
what1
what1
what2
e.g.,
prelspec = list(list(what1 = "kinpar", what2 = "kinpar", ind1 = 1,
ind2 = 5))
relates the 1st element of kinpar
to the 5th element of
kinpar
. The starting values parameterizing the relationship are
given in the prel
vector
positivepar
:"vector"
containing
character strings of those parameter vectors to constrain to positivity,
e.g., positivepar=c("kinpar")
weight
:"logical"
TRUE
when the specification in
weightpar
is to be applied and FALSE
otherwisepsi.df
:"matrix"
dataset from 1 experimentpsi.weight
:"matrix"
weighted dataset from 1 experimentx
:"vector"
time or other independent
variable. nt
:"integer"
length x
x2
:"vector"
vector of points in
2nd independent dimension, such as wavelengths of wavenumbersnl
:"integer"
length x2
C2
:"matrix"
concentration matrix for
simulated dataE2
:"matrix"
matrix of spectra for
simulated datasigma
:"numeric"
noise level in
simulated data parnames
:"vector"
vector of
parameter names, used internallyfinished
:"logical"
describes
whether optimization is completesimdata
:"logical"
logical that is TRUE
if the data is simulated,
FALSE
otherwise; will determine whether values in C2
and
E2
are plotted with resultsweightM
:"matrix"
weights weightsmooth
:"list"
type of smoothing to apply with weighting; not currently
usedmakeps
:"character"
specifyies the prefix of files written to
postscript
lclp0
:"logical"
TRUE
if specification in clp0
is to be applied and FALSE
otherwise lclpequ
:"logical"
TRUE
if specification in clpequspec
is to be applied and FALSE
otherwisetitle
:"character"
displayed on output plotsmhist
:"list"
list describing fitting historydatCall
:"list"
list of calls to functionsdscalspec
:"list"
drel
:"vector"
vector of starting parameters for dataset scaling relationsscalx
:"numeric"
numeric by which to scale the x
axis in plottingfvecind
:"vector"
vector containing indices of fixed parameterspvecind
:"vector"
used internally to
store indices of related parameters. groups
:"list"
list containing lists of pairs c(x2 index, dataset index).
the x2
values (which are solved for as conditionally linear
parameters) are equated for all pairs in a list.iter
:"numeric"
describing the
number of iterations that is run; this is sometimes
stored after fitting, but has not effect as an argument to
initModel
clpCon
:"list"
used internally to enforce constraints on the clpncomp
:"numeric"
describing the number of components in a modelclpdep
:"logical"
describing whether a model is dependent on the index
of x2
inten
:"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 the readData
function for more information. datafile
:"character"
containing the name of a datafile associated with the psi.df
clpType
:"character"
that is "nt" if the model has clp in the "x" dimension and "nl" otherwise
(so that, e.g., if mod\_type = "kin"
, then clpType = "nl"
).Katharine M. Mullen, Ivo H. M. van Stokkum
# 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))