I am trying to figure out how to fit nonlinear function to my data using Optim package.
Here is example
# data x and y
using Optim
model(x,p) = p[1] .+ p[2] .* x .+ p[3] .*x.^2
loss_function(p) = sum((model(x,p) .- y).^2
p0 = [0., 0., 0.]
result = optimize(loss_function, p0 )
Now I would like to fix one of the fitting parametrs, e.g. p[2] = 1.0
And fit the data just using parameters p[1] and p[3].