Fits a function that returns a third-order polynomial regression
Usage
fit_thirdpoly(a, b, c, d, inv = F)
Arguments
- a
coefficient of the cubic term (x^3)
- b
coefficient of the quadratic term (x^2)
- c
coefficient of the linear term (x)
- d
constant term
- inv
if TRUE
return inverse
Value
function that accepts x and returns y based on fitted model
Details
Fits a third-order polynomial regression:
$$
a \cdot x^3 + b \cdot x^2 + c \cdot x + d
$$
Examples
my_func <- EndoSim:::fit_thirdpoly(0.00001084, -0.0021, -0.0272, -0.0145)
plot(seq(0, 50, by = 0.1), my_func(seq(0, 50, by = 0.1)), type = "l")