SSpexpf | R Documentation |
Self starter for an plateau-exponential function
pexpf(x, a, xs, c)
SSpexpf(x, a, xs, c)
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 |
The equation is: for x < xs: y = a and x >= xs: a * exp(c * (x-xs))
.
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
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)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.