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. These slots may be specified in the ... argument of the initModel function; note that slots that are usual for a user to input have descriptions prefaced by a star (*) below.

Objects from the Class

Objects 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

psi.df:
* Object of class "matrix" dataset from 1 experiment
psi.weight:
Object of class "matrix" weighted dataset from 1 experiment
x:
Object of class "vector" time or other independent variable.
nt:
Object of class "integer" length x
x2:
Object of class "vector" vector of points in 2nd independent dimension, such as wavelengths of wavenumbers
nl:
Object of class "integer" length x2
C2:
Object of class "matrix" concentration matrix for simulated data
E2:
Object of class "matrix" matrix of spectra for simulated data
sigma:
Object of class "numeric" noise level in simulated data
mod_type:
* Object of class "character" character string defining the model type, e.g., "kin" or "spec"
parnames:
Object of class "vector" vector of parameter names, used internally
finished:
Object of class "logical" describes whether optimization is complete
simdata:
* Object of class "logical" * logical that is TRUE if the data is simulated, FALSE otherwise; will determine whether values in C2 and E2 are plotted with results
weightpar:
* Object of class "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.

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, weight_par = 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.

weight:
Object of class "logical" TRUE when the specification in weightpar is to be applied and FALSE otherwise
weightM:
Object of class "matrix" weights
weightsmooth:
Object of class "list" type of smoothing to apply with weighting; not currently used
fixed:
* Object of class "list" list of lists or vectors giving the parameter values to fix (at their starting values) during optimization.
clp0:
* Object of class "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.
makeps:
* Object of class "character" specifyies the prefix of files written to postscript
clpequspec:
* Object of class "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.
lclp0:
Object of class "logical" TRUE if specification in clp0 is to be applied and FALSE otherwise
lclpequ:
Object of class "logical" TRUE if specification in clpequspec is to be applied and FALSE otherwise
title:
* Object of class "character" displayed on output plots
mhist:
Object of class "list" list describing fitting history
datCall:
Object of class "list" list of calls to functions
drel
* vector of starting parameters for dataset scaling relations
dscalspec:
* Object of class "list"
drel:
* Object of class "vector" vector of starting parameters for dataset scaling relations
clpequ:
Object of class "vector" describes the clp equality constraints for internal use
scalx:
* Object of class "numeric" numeric by which to scale the x axis in plotting
prel
vector of starting values for the relations described in prelspec
prel:
* Object of class "vector" vector of starting values for the relations described in prelspec
prelspec:
* Object of class "list" list of lists to specify the functional relationship between parameters, each of which has elements

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

fvecind:
Object of class "vector" vector containing indices of fixed parameters
pvecind:
Object of class "vector" used internally to store indices of related parameters.
groups:
Object of class "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:
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 to initModel
clpCon:
Object of class "list" used internally to enforce constraints on the clp
ncomp:
Object of class "numeric" describing the number of components in a model
clpdep:
Object of class "logical" describing whether a model is dependent on the index of x2
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 the readData function for more information.
positivepar:
* Object of class "vector" containing character strings of those parameter vectors to constrain to positivity, e.g., positivepar=c("kinpar")

Author(s)

Katharine M. Mullen, Ivo H. M. van Stokkum

See Also

kin-class, spec-class

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 

 # 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))

[Package TIMP version 1.0 Index]