What about LsqFit? Here is an example for a similar model (Lorentz fit):

using LsqFit

x = -16:0.5:35
y = 19.4./((x - 7).^2 + 15.8) + randn(size(x))./10;  

model(x, p) = p[1]./((x-p[2]).^2+p[3]) 

fit = curve_fit(model, x, y, [25.,10.,10.]) 
p = fit.param 
f = p[1]./((x-p[2]).^2+p[3]) 

using GR 
plot(x, y, "d", x, f, "-", linewidth=2)


... and the result:


<https://lh3.googleusercontent.com/-5ur05FWaa4k/V0f3PEe0kFI/AAAAAAAAACo/z9wRKvLomWQAEM-8IPXTBxOLTk9AKSGvQCLcB/s1600/lorentzfit.png>



On Friday, May 27, 2016 at 12:18:16 AM UTC+2, Jan Drugowitsch wrote:
>
> Hi all,
>
> I have some nonlinear regression problems that I'd like to solve. 
> Unfortunately, NLreg.jl doesn't seem to work on my Julia 0.4.5 
> installation, but instead fails on the README example code with
>
> julia> const sd1 = readtable(Pkg.dir("NLreg","data","sd1.csv.gz"));
>
>
> julia> nl = fit(BolusSD1(CONC ~ TIME, sd1))
> WARNING: [a,b] concatenation is deprecated; use [a;b] instead
>  in depwarn at deprecated.jl:73
>  in oldstyle_vcat_warning at /Applications/Julia-0.4.5.app/Contents/
> Resources/julia/lib/julia/sys.dylib
>  in call at /Users/jandrugowitsch/.julia/v0.4/NLreg/src/plreg.jl:119
>  in fit at /Users/jandrugowitsch/.julia/v0.4/NLreg/src/plreg.jl:204
> while loading no file, in expression starting on line 0
> ERROR: type Array has no field data
>  in gpinc at /Users/jandrugowitsch/.julia/v0.4/NLreg/src/plreg.jl:143
>  in gpfit at /Users/jandrugowitsch/.julia/v0.4/NLreg/src/plreg.jl:159
>  in fit at /Users/jandrugowitsch/.julia/v0.4/NLreg/src/plreg.jl:204
>
>
> In general, NLreg.jl hasn't been updated since 2014. Are there any more 
> up-to-date Julia packages for nonlinear regression?
>
> I know that I could always use optimizers, but then I won't get all the 
> extra statistics that I would need.
>
> Thanks,
> Jan
>

Reply via email to