Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

SSpexpf

self start for plateau-exponential function


Description

Self starter for an plateau-exponential function

Usage

pexpf(x, a, xs, c)

SSpexpf(x, a, xs, c)

Arguments

x

input vector (x)

a

represents the value for the plateau

xs

represents the breakpoint at which the plateau ends

c

represents the exponential rate

Details

The equation is: for x < xs: y = a and x >= xs: a * exp(c * (x-xs)).

Value

a numeric vector of the same length as x containing parameter estimates for equation specified

pexpf: vector of the same length as x using the pexpf function

Examples

require(ggplot2)
set.seed(1234)
x <- 1:30
y <- pexpf(x, 20, 15, -0.2) + rnorm(30, 0, 1)
dat <- data.frame(x = x, y = y)
fit <- nls(y ~ SSpexpf(x, a, xs, c), data = dat)
## plot
ggplot(data = dat, aes(x = x, y = y)) + 
  geom_point() + 
  geom_line(aes(y = fitted(fit)))

nlraa

Nonlinear Regression for Agricultural Applications

v0.89
GPL-3
Authors
Fernando Miguez [aut, cre] (<https://orcid.org/0000-0002-4627-8329>), José Pinheiro [ctb, cph] (author of nlme::nlsList, nlme::predict.gnls, nlme::predict.nlme), Douglas Bates [ctb, cph] (author of nlme::nlsList, nlme::predict.gnls, nlme::predict.nlme), R-core [ctb, cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.