Cubic fit
Use the fitcubic function:
using EasyFit, Plots, Random
Random.seed!(1)
x = sort(rand(10))
y = x .^ 3 .+ 0.1 * rand(10)
fit = fitcubic(x, y)------------------- Cubic Fit -----------------
Equation: y = ax^3 + bx^2 + cx + d
With: a = 0.04839086222118117
b = 1.4420079201420501
c = -0.6191242735056691
d = 0.10355720978841285
Correlation coefficient, R² = 0.9878064946938877
Average square residue = 0.0006187983258828172
Predicted Y: ypred = [ 0.08947765138281931, 0.07660607930152655, ...]
residues = [ -0.004968161611310806, 0.030382182690853674, ...]
-----------------------------------------------
scatter(x, y, label="data", framestyle=:box)
plot!(fit.x, fit.y, label="fit", linewidth=2)