View source: R/fitExponential.R
fitExponential | R Documentation |
Fit the model $y = a e^bx$ to the provided data.
fitExponential(x, y, a0 = 0, b0 = 0)
x |
x data |
y |
y data |
a0 |
start value (default: 1) |
b0 |
start value (default: 1) |
Named vector of coefficients ('a', 'b')
age <- c(2, 10, 25, 47, 70, 90) risk <- c(0.01, 0.07, 0.15, 0.65, 3, 12.64) plot(age, risk) ab <- fitExponential(x = age, y = risk, a0 = 1, b0 = 0) y <- ab[1] * exp(ab[2] * age) lines(age, y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.