SSgompertz: Self-starting Gompertz models

SSgompertzR Documentation

Self-starting Gompertz models

Description

Creates initial coefficient estimates for selfStart wrappers around gompertz() and gompertz_left(), for use with stats::nls(). Both wrappers use the same 4-parameter (A, B, xmid, slope) interface.

Usage

SSgompertz(t, A, B, xmid, slope)

SSgompertz_left(t, A, B, xmid, slope)

SSgompertz_left(t, A, B, xmid, slope)

Arguments

t

A numeric vector of the predictor variable (time).

A

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

B

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

xmid

A numeric parameter for the time at the inflection point (the steepest point) of the curve, in units of the predictor variable t.

slope

A numeric parameter for the response rate dx/dt at the inflection xmid.

Details

Model formulas

  • Right-Gompertz: x ~ SSgompertz(t, A, B, xmid, slope)

  • Left-Gompertz: x ~ SSgompertz_left(t, A, B, xmid, slope)

Used by analyse_kinetics() with method = "sigmoidal" and shape = "gompertz" or "gompertz_left". Starting estimates locate the inflection from a smoothed first derivative. SSgompertz() masks stats::SSgompertz().

Fixing parameters

Any parameter may be held constant by writing a value in place of its name in the formula, e.g. x ~ SSgompertz(t, A = 0, B, xmid, slope) fixes the starting asymptote at A = 0. Fixed parameters are excluded from estimation and are not returned by stats::coef().

Value

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

See Also

gompertz(), gompertz_left(), analyse_kinetics(), SSlogistic(), stats::nls(), stats::selfStart(), stats::SSgompertz()

Examples

## create a Gompertz curve with random noise
set.seed(15)
t <- 1:60
x <- gompertz(t, A = 10, B = 100, xmid = 30, slope = 4) +
    rnorm(length(t), 0, 2)
data <- data.frame(t, x)

model <- nls(x ~ SSgompertz(t, A, B, xmid, slope), data = data)
summary(model)

## fix the starting asymptote `A` at a known value
model_fixed <- nls(x ~ SSgompertz(t, A = 10, B, xmid, slope), data = data)
summary(model_fixed)

## left-Gompertz
set.seed(16)
x2 <- gompertz_left(t, A = 10, B = 100, xmid = 30, slope = 4) +
    rnorm(length(t), 0, 2)
data2 <- data.frame(t, x = x2)

model_left <- nls(x ~ SSgompertz_left(t, A, B, xmid, slope), data = data2)
summary(model_left)


mnirs documentation built on Sept. 13, 2026, 1:06 a.m.