I want to preform a weigted least squares fit with LsqFit.jl
The documentation ( Tutorial · LsqFit.jl (julianlsolvers.github.io)) does have a section on it, but no example of
curve_fit() actually being called with a weight-vector. I have tried the following, with one of the last two lines commented out at a time:
using LsqFit model(ys, p) = @. p*ys+p xdata = 1:100 ydata = xdata + randn(length(xdata)) wt = xdata # This line throws a method error curve_fit(R_model, xdata, ydata, [1.0, 1.0], wt=wt) # This line throws a dimension error, but seems to misunderstand what I want curve_fit(R_model, xdata, ydata, [1.0, 1.0], wt)
I don’t know if I am passing the arguments in the wrong way, but I can not find an example for how to do it. Anyone know how?