Skip to contents

Calculate a 3- or 4-parameter monoexponential curve. Model family fit by analyse_kinetics() with method = "monoexponential", and by stats::nls() via the self-starting wrapper SSmonoexponential().

Usage

monoexponential(t, A, B, tau, TD = NULL)

Arguments

t

A numeric vector of the predictor variable (time).

A

A numeric parameter for the starting baseline of the response variable.

B

A numeric parameter for the ending asymptote of the response variable.

tau

A numeric parameter for the time constant (\(\tau\)) of the exponential response, in units of the predictor variable t.

TD

A numeric parameter for the time delay before the onset of the exponential response, in units of the predictor variable t. If NULL (default), a 3-parameter model without time delay is used.

Value

A numeric vector of predicted values the same length as the predictor variable t.

Details

Model equations

  • 3-parameter: A + (B - A) * (1 - exp(-t / tau))

  • 4-parameter: A + (B - A) * (1 - exp(-pmax(t - TD, 0) / tau))

Clamping the shifted time at zero holds the curve flat at the baseline A until the response onset at t = TD.

Derived quantities

The rate constant k is the reciprocal of tau (k = 1 / tau) in reciprocal units of t (e.g. sec^-1). The mean response time is the time sum MRT = TD + tau, and the half-response time is HRT = TD + tau * log(2).

Examples

## create an exponential curve with random noise
set.seed(13)
t <- 1:60
x <- monoexponential(t, A = 10, B = 100, tau = 8, TD = 15) +
    rnorm(length(t), 0, 3)
data <- data.frame(t, x)

## 4-parameter fit with the self-starting wrapper
model <- nls(x ~ SSmonoexponential(t, A, B, tau, TD), data = data)
summary(model)
#> 
#> Formula: x ~ SSmonoexponential(t, A, B, tau, TD)
#> 
#> Parameters:
#>     Estimate Std. Error t value Pr(>|t|)    
#> A    10.4611     0.7622   13.72   <2e-16 ***
#> B   100.2334     0.7527  133.17   <2e-16 ***
#> tau   8.3128     0.3562   23.34   <2e-16 ***
#> TD   14.8835     0.1898   78.43   <2e-16 ***
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> Residual standard error: 2.852 on 56 degrees of freedom
#> 
#> Number of iterations to convergence: 4 
#> Achieved convergence tolerance: 1.182e-06
#> 

y <- predict(model, data)

# \donttest{
    if (requireNamespace("ggplot2", quietly = TRUE)) {
        ggplot2::ggplot(data, ggplot2::aes(t, x)) +
            theme_mnirs() +
            ggplot2::geom_point() +
            ggplot2::geom_line(ggplot2::aes(y = y))
    }

# }