Skip to contents

Calculate a four-parameter monoexponential curve.

Usage

monoexponential(x, A, B, TD, tau)

Arguments

x

A numeric predictor variable at which to evaluate the response variable y.

A

A numeric parameter for the starting (baseline) value of the response variable y.

B

A numeric parameter for the ending (asymptote) value of the response variable y.

TD

A numeric parameter for the time delay before exponential inflection of the curve, in units of the predictor variable x.

tau

A numeric parameter for the time constant tau (𝜏) of the exponential curve, in units of the predictor variable x. tau is equal to the reciprocal of k (tau = 1/k), where k is the rate constant of the same function.

Value

A numeric vector for the response variabel y of the same length as the predictor variable x.

Examples

set.seed(13)
x <- seq(0, 60, by = 2)
A <- 10; B <- 100; TD <- 15; tau <- 8
y <- monoexponential(x, A, B, TD, tau) + rnorm(length(x), 0, 3)
data <- data.frame(x, y)

model <- nls(y ~ SSmonoexp(x, A, B, TD, tau), data = data)
model
#> Nonlinear regression model
#>   model: y ~ SSmonoexp(x, A, B, TD, tau)
#>    data: data
#>      A      B     TD    tau 
#> 11.973 99.313 15.229  7.976 
#>  residual sum-of-squares: 232.9
#> 
#> Number of iterations to convergence: 5 
#> Achieved convergence tolerance: 5.452e-06

if (FALSE) { # \dontrun{
plot(x, y)
lines(x, y)
points(x, y)
lines(x, fitted(model), col = "red")
} # }