onetcm: One Tissue Compartment Model

View source: R/kinfitr_1tcm.R

onetcmR Documentation

One Tissue Compartment Model

Description

Function to fit the One Tissue Compartment Model to data. An irreversible model can also be specified by setting the starting value, upper and lower bounds of k2 to 0.

Usage

onetcm(
  t_tac,
  tac,
  input,
  weights = NULL,
  inpshift = NULL,
  vB = NULL,
  frameStartEnd = NULL,
  K1.start = 0.1,
  K1.lower = 1e-04,
  K1.upper = 0.5,
  k2.start = 0.1,
  k2.lower = 1e-04,
  k2.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
)

Arguments

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 blood_interp function.

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.

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 0.5.

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.

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 nls_multstart. If specified as 1 for any parameters, the original starting value will be used, and the multstart_lower and multstart_upper values ignored.

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.

Value

A list with a data frame of the fitted parameters out$par, their percentage standard errors 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.

Author(s)

Granville J Matheson, mathesong@gmail.com

Examples


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 <- onetcm(t_tac, tac, input, weights)
fit2 <- onetcm(t_tac, tac, input, weights, inpshift = 0.1, vB = 0.05)

mathesong/kinfitr documentation built on Jan. 15, 2024, 11:07 p.m.