SSbragg: Bragg's Equation

SSbraggR Documentation

Bragg's Equation

Description

These functions provide the Bragg's equations, that is based on the normal (Gaussian) distribution and it supports a maximum, a minimum and inflection points. These functions provide the equations with 4 (bragg.4.fun) and 3 (bragg.3.fun) parameters with self-starters for the nls function (NLS.bragg.4, NLS.bragg.3) and the self-starters for the drm function in the drc package (DRC.bragg.4, DRC.bragg.3)

Usage

bragg.4.fun(X, b, c, d, e)
bragg.3.fun(X, b, d, e)
NLS.bragg.4(X, b, c, d, e)
NLS.bragg.3(X, b, d, e)
DRC.bragg.4()
DRC.bragg.3()

Arguments

X

a numeric vector of values at which to evaluate the model

b

model parameter (relates to slope at inflection point)

d

model parameter (maximum value)

e

model parameter (abscissa at maximum value)

c

model parameter (lower asymptote)

Details

The Bragg's equation is parameterised as:

f(x) = c + \left(d - c \right) \, \exp(- b \cdot (X - e)^2)

for the 4-parameter model. For the 3-parameter model, c is equal to 0. It depicts a bell-shaped curve

Value

bragg.4.fun, bragg.3.fun, NLS.bragg.4 and NLS.bragg.3 return a numeric value, while DRC.bragg.4 and DRC.bragg.3 return a list containing the nonlinear function and the self starter function

Author(s)

Andrea Onofri

References

Ratkowsky, DA (1990) Handbook of nonlinear regression models. New York (USA): Marcel Dekker Inc.

Onofri, A. (2020). A collection of self-starters for nonlinear regression in R. See: https://www.statforbiology.com/2020/stat_nls_usefulfunctions/

Examples

library(statforbiology)
X <- c(5, 10, 15, 20, 25, 30, 35, 40, 45, 50)
Y1 <- c(0.1, 2, 5.7, 9.3, 19.7, 28.4, 20.3, 6.6, 1.3, 0.1)
Y2 <- Y1 + 2

# nls fit
mod.nls <- nls(Y1 ~ NLS.bragg.3(X, b, d, e) )
mod.nls2 <- nls(Y2 ~ NLS.bragg.4(X, b, c, d, e) )

# drm fit
mod.drc <- drm(Y1 ~ X, fct = DRC.bragg.3() )
mod.drc2 <- drm(Y2 ~ X, fct = DRC.bragg.4() )
plot(mod.drc, ylim = c(0, 30), log = "")
plot(mod.drc2, add = TRUE, col = "red")



statforbiology documentation built on Oct. 30, 2024, 9:13 a.m.