dbllgs: dbllgs

View source: R/dbllgs.r

dbllgsR Documentation

dbllgs

Description

A double logistic function, which is the product of two logistic functions lgs1 and lgs2. When all parameters are positive, lgs1 is a function of parameters a1 and b1, and increases with x, while lgs2 is a function of parameters a2 and b2, and decreases with x.

Usage

dbllgs(x, a1, b1, a2, b2, par = NULL, type = "dbl")

Arguments

x

numeric vector

a1

slope parameter for lgs1

b1

point of inflection (e.g. a50) for lgs1

a2

slope parameter for lgs2

b2

point of inflection (e.g. a50) for lgs2

par

named vector of parameters a1, b1, a2, b2. If this is specified it will override specifications of individual parameters

type

output type. Return the double logistic ("dbl"), "lgs1", "lgs2", or "all" to return a data frame of "x", "lgs1", "lgs2", and "dbl"

Author(s)

Kyle Shertzer and Nikolai Klibansky

Examples

## Not run: 
# Nice domed shape
x <- 1:40
y <- dbllgs(x=x, a1=1, b1=5, a2=1, b2=10)
plot(x,y)

# Alternative way to specify parameters
y <- dbllgs(x=x, par=c(x=x, a1=1, b1=5, a2=1, b2=10))
plot(x,y)

# Return lgs1
y <- dbllgs(x=x, a1=1, b1=5, a2=1, b2=10, type="lgs1")
plot(x,y)

# Return lgs2
y <- dbllgs(x=x, a1=1, b1=5, a2=1, b2=10, type="lgs2")
plot(x,y)

# Return all
dat <- dbllgs(x=x, a1=1, b1=5, a2=1, b2=10, type="all")
matplot(dat[,1],dat[,2:4],type="l",col=c("red","blue","purple"), lwd=2, lty=c(2,2,1))

## End(Not run)

nikolaifish/bamExtras documentation built on July 21, 2023, 8:26 a.m.