powered by
Get coeff from an exponential fit
getExpCoeff(x, y, a0 = 0, b0 = 0)
x data
y data
start value (default: 1)
named vector of coefficients ("a", "b")
# NOT RUN { 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 <- getExpCoeff(x=age, y=risk, a0 = 1, b0 = 0) y <- ab[1] * exp( ab[2] * age) lines(age, y) # }
Run the code above in your browser using DataLab