Can LsqFit.jl be used to fit multivariate model? I tried this but must have missed something (maybe xv and Y need to have same length?):
using LsqFit # We want to try to use curve_fit to fit the parameters of this multivariate model: mvmodel(x, p) = begin p[1] .* ((x[1,:] .^ p[2]) ./ (x[2,:] .^ p[3])) end N = 10 M = 2 X = randn(M, N) Params = [1.0, 2.0, 2.0] # Actual params that we are looking for # Dependent var with small error term Y = mvmodel(X, Params)[:] + 0.01*randn(N) # We need a vector to submit to curve_fit: xv = X[:] # Reshape to get back the original matrix. orig_matrix(xv, M) = reshape(xv, (M, int(length(xv)/M))) # The model function we supply to curve_fit needs to take a vector... model(xv, p) = mvmodel(orig_matrix(xv, M), p) fit = curve_fit(model, xv, Y, [0.5, 0.5, 0.5]) Den måndagen den 14:e juli 2014 kl. 20:10:02 UTC+2 skrev Blake Johnson: > > The curve fitting functionality in Optim.jl is being moved into its own > package: LsqFit.jl: > > https://github.com/JuliaOpt/LsqFit.jl > > Installable via Pkg.add("LsqFit"). >
