twotcm | R Documentation |
Function to fit the Two Tissue Compartment Model to data.
twotcm(
t_tac,
tac,
input,
weights = NULL,
inpshift = NULL,
vB = NULL,
frameStartEnd = NULL,
K1.start = 0.1,
K1.lower = 1e-04,
K1.upper = 1,
k2.start = 0.1,
k2.lower = 1e-04,
k2.upper = 0.5,
k3.start = 0.1,
k3.lower = 1e-04,
k3.upper = 0.5,
k4.start = 0.1,
k4.lower = 1e-04,
k4.upper = 0.5,
inpshift.start = 0,
inpshift.lower = -0.5,
inpshift.upper = 0.5,
vB.start = 0.05,
vB.lower = 0.01,
vB.upper = 0.1,
multstart_iter = 1,
multstart_lower = NULL,
multstart_upper = NULL,
printvals = F
)
t_tac |
Numeric vector of times for each frame in minutes. We use the time halfway through the frame as well as a zero. If a time zero frame is not included, it will be added. |
tac |
Numeric vector of radioactivity concentrations in the target tissue for each frame. We include zero at time zero: if not included, it is added. |
input |
Data frame containing the blood, plasma, and parent fraction
concentrations over time. This can be generated using the
|
weights |
Optional. Numeric vector of the weights assigned to each frame in the fitting. We include zero at time zero: if not included, it is added. If not specified, uniform weights will be used. |
inpshift |
Optional. The number of minutes by which to shift the timing of the input data frame forwards or backwards. If not specified, this will be fitted, however this takes longer to compute. Recommended to perform once on a large ROI for each measurement, and to specify this value for the remainder of the regions. Or perhaps even to use a simpler model, such as 1TCM. |
vB |
Optional. The blood volume fraction. If not specified, this will be fitted. Recommended to perform once on a large ROI for each measurement, and to specify this value for the remainder of the regions. |
frameStartEnd |
Optional: This allows one to specify the beginning and final frame to use for modelling, e.g. c(1,20). This is to assess time stability. |
K1.start |
Optional. Starting parameter for fitting of K1. Default is 0.1. |
K1.lower |
Optional. Lower bound for the fitting of K1. Default is 0.0001. |
K1.upper |
Optional. Upper bound for the fitting of K1. Default is 1. |
k2.start |
Optional. Starting parameter for fitting of k2. Default is 0.1. |
k2.lower |
Optional. Lower bound for the fitting of k2. Default is 0.0001. |
k2.upper |
Optional. Upper bound for the fitting of k2. Default is 0.5. |
k3.start |
Optional. Starting parameter for fitting of k3. Default is 0.1. |
k3.lower |
Optional. Lower bound for the fitting of k3. Default is 0.0001. |
k3.upper |
Optional. Upper bound for the fitting of k3. Default is 0.5. |
k4.start |
Optional. Starting parameter for fitting of k4. Default is 0.1. |
k4.lower |
Optional. Lower bound for the fitting of k4. Default is 0.0001. |
k4.upper |
Optional. Upper bound for the fitting of k4. Default is 0.5. |
inpshift.start |
Optional. Starting parameter for fitting of inpshift. Default is 0. |
inpshift.lower |
Optional. Lower bound for the fitting of inpshift. Default is -0.5. |
inpshift.upper |
Optional. Upper bound for the fitting of inpshift. Default is 0.5. |
vB.start |
Optional. Starting parameter for fitting of vB. Default is 0.05. |
vB.lower |
Optional. Lower bound for the fitting of vB. Default is 0.01. |
vB.upper |
Optional. Upper bound for the fitting of vB. Default is 0.1. |
multstart_iter |
Number of iterations for starting parameters. Default
is 1. For more information, see |
multstart_lower |
Optional. Lower bounds for starting parameters. Defaults to the lower bounds. Named list of whichever parameters' starting bounds should be altered. |
multstart_upper |
Optional. Upper bounds for starting parameters. Defaults to the upper bounds. Named list of whichever parameters' starting bounds should be altered. |
printvals |
Optional. This displays the parameter values for each iteration of the model. This is useful for debugging and changing starting values and upper and lower bounds for parameters. |
A list with a data frame of the fitted parameters out$par
,
their percentage standard errors (scaled so that 1 represents 100%)
out$par.se
, the model fit object out$fit
, a dataframe
containing the TACs both of the data and the fitted values out$tacs
,
the blood input data frame after time shifting input
, a vector of
the weights out$weights
, a logical of whether the inpshift was
fitted inpshift_fitted
and a logical of whether the vB was fitted
vB
.
Granville J Matheson, mathesong@gmail.com
data(pbr28)
t_tac <- pbr28$tacs[[2]]$Times / 60
tac <- pbr28$tacs[[2]]$FC
weights <- pbr28$tacs[[2]]$Weights
input <- blood_interp(
pbr28$procblood[[2]]$Time / 60, pbr28$procblood[[2]]$Cbl_dispcorr,
pbr28$procblood[[2]]$Time / 60, pbr28$procblood[[2]]$Cpl_metabcorr,
t_parentfrac = 1, parentfrac = 1
)
fit1 <- twotcm(t_tac, tac, input, weights)
fit2 <- twotcm(t_tac, tac, input, weights, inpshift = 0.1, vB = 0.05)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.