Description Usage Arguments Value Author(s) See Also Examples
Functions to print and return parts of the object returned
by fitModel
. onls
returns the output of the
nls
function. sumonls
returns the result of calling summary
on onls
function. parEst
returns a summary of model
parameter estimates. The remaining functions return lists
representing various aspects of the results returned by the function
fitModel.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | onls(result)
sumnls(result)
parEst(result, param = "", dataset = NA, verbose = TRUE, file="",
stderr=TRUE)
getXList(result, group = vector(), file="")
getCLPList(result, getclperr = FALSE, file="")
getX(result, group = vector(), dataset=1, file="", lreturnA = FALSE, lreturnC = FALSE)
getC(result, dataset=1, file="")
getCLP(result, getclperr = FALSE, dataset=1, file="")
getDAS(result, getclperr = FALSE, dataset=1, file="")
getData(result, dataset = 1, weighted = FALSE)
getResiduals(result, dataset = 1)
getSVDResiduals(result, numsing = 2, dataset = 1)
getTraces(result, dataset = 1, file="")
getdim1(result, dataset = 1)
getdim2(result, dataset = 1)
|
result |
return value of |
param |
character vector of the particular parameters to return;
if |
dataset |
index of the dataset from which to return results; by
default |
verbose |
logical that defaults to |
getclperr |
logical that defaults to |
numsing |
integer that defaults to 2; determines the number of singular vectors to return |
weighted |
logical indicating whether to return weighted or unweighted data |
lreturnA |
logical indicating whether to return an A matrix instead |
lreturnC |
logical indicating whether to return a C matrix instead |
file |
character vector; if not |
group |
The value at which to determine the X matrix (maybe a wavelenth index, for example) |
stderr |
Whether to return standard error estimates on parameters, if they were calculated in fitting. |
sumnls
returns an object of class "summary.nls"
.
onls
returns an object of class "nls"
.
parEst
returns an object of class "list"
representing
the parameter estimates and the standard errors if stderr=TRUE
and they have been calculated.
getXList
returns a "list"
of length equal to the number of
datasets modeled, where each element represents the matrix determined
by the nonlinear parameters (under a kinetic model, the concentrations).
getCLPList
returns a "list"
of length equal to the number of
datasets modeled, where each element represents the matrix determined
as conditionally linear parameters (under a kinetic model, the spectra).
getX
returns a numeric "matrix"
that represents the matrix determined
by the nonlinear parameters (under a kinetic model, the concentrations).
However, in case lreturnC = TRUE it returns the C matrix, and in case
lreturnA = TRUE it returns the A matrix that is used to compute
the C matrix in case the kinetic model differs from parallel decays.
getC
returns (under a kinetic model) a numeric "matrix"
that represents the raw matrix of concentrations of the dataset determined
by the nonlinear parameters.
getDAS
returns (under a kinetic model) a numeric "matrix"
that represents the Decay Associated Spectra (DAS).
getCLPList
returns a numeric "matrix"
that represents the matrix determined
as conditionally linear parameters (under a kinetic model, the spectra).
getSVDData
returns a "list"
of length 3 with named elements
values
, left
and right
, where values
contains the singular values, left
contains numsing
left singular vectors, and right
contains numsing
right singular vectors, all of the unweighted data. The number of singular
vectors returned is determined by numsing
.
getData
returns the dataset specified by the
argument dataset
(weighted data in the case
that weighted=TRUE
) as a "matrix"
getResiduals
returns a "matrix"
of residuals for the
dataset with index given by the argument dataset
; the matrix
returned has the dimension of the dataset itself.
getSVDResiduals
returns a "list"
of length 3 with named elements
values
, left
and right
, where values
contains the singular values, left
contains numsing
left singular vectors, and right
contains numsing
right singular vectors, all of the residuals. The number of singular
vectors returned is determined by numsing
.
getTraces
returns a "matrix"
of model estimates for the
dataset with index given by the argument dataset
; the matrix
returned has the dimension of the dataset itself.
getdim1
returns a "vector"
of
x
values in the dataset (times for kinetic models).
getdim2
returns a "vector"
of
x2
values (wavelengths for kinetic models).
Katharine M. Mullen, Ivo H. M. van Stokkum
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | ## Not run:
## Example showing the addition of non-negativity constraints to
## conditionally linear parameters (here the spectra associated with
## a kinetic model)
## For the 1st simulated dataset, the constraints offer a modest improvement
## in the estimated spectra, whereas for the 2nd simulated dataset, they
## prevent a catastrophe in which the estimated components are hugely
## compensating.
##############################
## load TIMP
##############################
require(TIMP)
##############################
## set random seed for reproducability of noise
##############################
set.seed(80)
##############################
## SIMULATE DATA, noise realization 1
##############################
dt4 <- simndecay_gen(kinpar = c(.4, .8, 2), seqmod = FALSE, tmax
= 2, deltat = .04, specpar = list(c(25000, 3000, .01), c(22000,
3000, .01), c(18000, 3000, .01)), lmin=350, lmax=550, deltal = 2,
sigma=.01)
##############################
## SPECIFY INITIAL MODEL
##############################
mod1 <- initModel(mod_type = "kin", kinpar = c(.4, .8, 2),
seqmod=FALSE)
##############################
## FIT INITIAL MODEL
##############################
sT <- fitModel(list(dt4), list(mod1), opt=kinopt(iter=50, plot=FALSE))
##############################
## EXTRACT ESTIMATED SPECTRA
## these spectra have some negative values
##############################
sTcp <- getCLP(sT)
## plot the estimated spectra with the values used in
## simulation (before adding noise) for comparison
matplot(dt4@x2, sTcp, xlab = "wavelength (nm)", col = 2:4, type="l",
ylab="",lty=1, main =
paste("Estimated spectra, adding no constraints\n"))
matplot(dt4@x2,dt4@E2, add=TRUE, type="l", col=1, lty=2)
abline(0,0)
##############################
## FIT INITIAL MODEL
## adding constraints to non-negativity of the
## spectra via the opt option nnls=TRUE
##############################
sV <- fitModel(list(dt4), list(mod1), opt=kinopt(iter=50, nnls=TRUE,
plot=FALSE))
##############################
## EXTRACT ESTIMATED SPECTRA
## these spectra have no negative values
##############################
sVcp <- getCLP(sV)
## plot the estimated spectra with the values used in
## simulation (before adding noise) for comparison
matplot(dt4@x2, sVcp, xlab = "wavelength (nm)", col = 2:4, type="l",
ylab="",lty=1,
main = paste("Estimated spectra, with non-negativity constraints\n"))
matplot(dt4@x2,dt4@E2, add=TRUE, type="l", col=1, lty=2)
abline(0,0)
##############################
## SIMULATE DATA, noise realization 2
##############################
dt4_2 <- simndecay_gen(kinpar = c(.4, .8, 2), seqmod = FALSE, tmax
= 2, deltat = .04, specpar = list(c(25000, 3000, .01), c(22000,
3000, .01), c(18000, 3000, .01)), lmin=350, lmax=550, deltal = 2,
sigma=.01)
##############################
## SPECIFY INITIAL MODEL
##############################
mod1 <- initModel(mod_type = "kin", kinpar = c(.4, .8, 2),
seqmod=FALSE)
##############################
## FIT INITIAL MODEL
##############################
sT <- fitModel(list(dt4_2), list(mod1), opt=kinopt(iter=50,plot=FALSE))
##############################
## EXTRACT ESTIMATED SPECTRA
## these spectra have some negative values
##############################
sTcp <- getCLP(sT)
## plot the estimated spectra with the values used in
## simulation (before adding noise) for comparison
matplot(dt4@x2, sTcp, xlab = "wavelength (nm)", col = 2:4, type="l",
ylab="",lty=1, main =
paste("Estimated spectra, adding no constraints\n"))
matplot(dt4@x2,dt4@E2, add=TRUE, type="l", col=1, lty=2)
abline(0,0)
##############################
## FIT INITIAL MODEL
## adding constraints to non-negativity of the
## spectra via the opt option nnls=TRUE
##############################
sV <- fitModel(list(dt4_2), list(mod1), opt=kinopt(iter=50, nnls=TRUE,
plot=FALSE))
##############################
## EXTRACT ESTIMATED SPECTRA
## these spectra have no negative values
##############################
sVcp <- getCLP(sV)
## plot the estimated spectra with the values used in
## simulation (before adding noise) for comparison
matplot(dt4@x2, sVcp, xlab = "wavelength (nm)", col = 2:4, type="l",
ylab="",lty=1,
main = paste("Estimated spectra, with non-negativity constraints\n"))
matplot(dt4@x2,dt4@E2, add=TRUE, type="l", col=1, lty=2)
abline(0,0)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.