Skip to contents

monoexp_init(): Returns initial values for the parameters in a selfStart model.

SSmonoexp(): Creates initial coefficient estimates for a selfStart model for the four-parameter monoexponential() function. For the parameters A, B, TD, and tau.

Usage

monoexp_init(mCall, data, LHS, ...)

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

Arguments

mCall

A matched call to the function model.

data

A data frame in which to interpret the variables in mCall.

LHS

The expression from the left-hand side of the model formula in the call to nls.

...

Additional 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

monoexp_init(): Initial starting estimates for parameters in the model called by SSmonoexp().

SSmonoexp(): A numeric vector for the response variabel y of the same length as the predictor variable x. Returned from the expression ifelse(x <= TD, A, A + (B - A) * (1 - exp((TD - x) / tau))).

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")
} # }