# \#lsqfit

**URL:** https://discourse.julialang.org/tag/lsqfit/1150.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Is \`LsqFit.jl\` abandoned?](https://discourse.julialang.org/t/is-lsqfit-jl-abandoned/125192)

<div class="topic-metadata">

**Author:** [@cocoa1231](https://discourse.julialang.org/u/cocoa1231)\
**Replies:** 2\
**Last updated:** [January 25, 2025, 6:03pm UTC](https://discourse.julialang.org/t/is-lsqfit-jl-abandoned/125192 "2025-01-25T18:03:28Z")

</div>

As the title says, is the package abandoned? There’s PRs that go back to 2020. Is LsqFit.jl no longer maintained? If so what’s the preferred way to do curve fitting similar to scipy.optimize.curve\_fit?

---

## [Fitting gaussian to spectral data has unexpected results](https://discourse.julialang.org/t/fitting-gaussian-to-spectral-data-has-unexpected-results/118961)

<div class="topic-metadata">

**Author:** [@Amnesian](https://discourse.julialang.org/u/Amnesian)\
**Replies:** 3\
**Last updated:** [September 4, 2024, 11:58am UTC](https://discourse.julialang.org/t/fitting-gaussian-to-spectral-data-has-unexpected-results/118961 "2024-09-04T11:58:54Z")

</div>

My data Trying to fit a gaussian (not Normal, because it has arbitrary amplitude) on a peak in my data produces very bad parameter values. Expected should be close to my initial guesses, but it outputs \[14936.1701885188…

---

## [Lsqfit Nonlinear Regression Using Two Parameters: One Parameter Is Stuck At The Initial Parameter Value](https://discourse.julialang.org/t/lsqfit-nonlinear-regression-using-two-parameters-one-parameter-is-stuck-at-the-initial-parameter-value/108001)

<div class="topic-metadata">

**Author:** [@HNormanW](https://discourse.julialang.org/u/HNormanW)\
**Replies:** 0\
**Last updated:** [December 24, 2023, 8:53am UTC](https://discourse.julialang.org/t/lsqfit-nonlinear-regression-using-two-parameters-one-parameter-is-stuck-at-the-initial-parameter-value/108001 "2023-12-24T08:53:48Z")

</div>

Hi, I’m trying to run a nonlinear regression fit for a perturbation function, but it seems to only fit one of my two parameters. The perturbation function is for modeling grating efficacy curves, with wavelength as the …

---

## [Question: Least square fitting method for non-linear function](https://discourse.julialang.org/t/question-least-square-fitting-method-for-non-linear-function/97595)

<div class="topic-metadata">

**Author:** [@manu\_han](https://discourse.julialang.org/u/manu_han)\
**Replies:** 2\
**Last updated:** [June 6, 2023, 6:47am UTC](https://discourse.julialang.org/t/question-least-square-fitting-method-for-non-linear-function/97595 "2023-06-06T06:47:32Z")

</div>

To fit the non-linear function with other data, I am trying to use the ‘LsqFit.curve\_fit’ which was introduced by the following link: GitHub - JuliaNLSolvers/LsqFit.jl: Simple curve fitting in Julia here is toy example…

---

## [How to use the array as the argument for curve-fit?](https://discourse.julialang.org/t/how-to-use-the-array-as-the-argument-for-curve-fit/99802)

<div class="topic-metadata">

**Author:** [@manu\_han](https://discourse.julialang.org/u/manu_han)\
**Replies:** 3\
**Last updated:** [June 4, 2023, 4:29pm UTC](https://discourse.julialang.org/t/how-to-use-the-array-as-the-argument-for-curve-fit/99802 "2023-06-04T16:29:22Z")

</div>

I wanna using curve-fit with an independent variable constituted by 4 float64 elements (Vector{Array{Float64,3} with 4 elements}. However, It didn’t work and give the message as follows: MethodError: no method matching…

---

## [ERROR: InexactError: Int64(NaN) in LsqFit.jl](https://discourse.julialang.org/t/error-inexacterror-int64-nan-in-lsqfit-jl/98580)

<div class="topic-metadata">

**Author:** [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Replies:** 1\
**Last updated:** [May 9, 2023, 11:28pm UTC](https://discourse.julialang.org/t/error-inexacterror-int64-nan-in-lsqfit-jl/98580 "2023-05-09T23:28:50Z")

</div>

If you face this issue working with LsqFit.jl it might help to specify the initial values p0 as floating point numbers, instead of Int. This was wrong in my example: p0 = \[100, 2000, 4000\] This cured the issue: p0 …

---

## [How to use the 'LsqFit.curve\_fit'?](https://discourse.julialang.org/t/how-to-use-the-lsqfit-curve-fit/97546)

<div class="topic-metadata">

**Author:** [@manu\_han](https://discourse.julialang.org/u/manu_han)\
**Replies:** 0\
**Last updated:** [April 16, 2023, 2:18pm UTC](https://discourse.julialang.org/t/how-to-use-the-lsqfit-curve-fit/97546 "2023-04-16T14:18:59Z")

</div>

To fit the non-linear function with other data, I am trying to use the ‘LsqFit.curve\_fit’ which was introduced by the following link: GitHub - JuliaNLSolvers/LsqFit.jl: Simple curve fitting in Julia here is toy example: …

---

## [Problems with LsqFit on an ODE-based model](https://discourse.julialang.org/t/problems-with-lsqfit-on-an-ode-based-model/91642)

<div class="topic-metadata">

**Author:** [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Replies:** 2\
**Last updated:** [December 14, 2022, 5:48pm UTC](https://discourse.julialang.org/t/problems-with-lsqfit-on-an-ode-based-model/91642 "2022-12-14T17:48:06Z")

</div>

I have a 1D experimental dataset and an ODE-based model. The model is able to describe experimental data reasonably well by manual fitting of the parameter: The next step now is using LsqFit, at first trying to fit ju…

---

## [Python lmfit takes weights into account, but Julia LsqFit package seems not to](https://discourse.julialang.org/t/python-lmfit-takes-weights-into-account-but-julia-lsqfit-package-seems-not-to/90679)

<div class="topic-metadata">

**Author:** [@humbleclaw](https://discourse.julialang.org/u/humbleclaw)\
**Replies:** 9\
**Last updated:** [November 23, 2022, 11:26pm UTC](https://discourse.julialang.org/t/python-lmfit-takes-weights-into-account-but-julia-lsqfit-package-seems-not-to/90679 "2022-11-23T23:26:35Z")

</div>

Hello everyone. Using Python I have been able to do non-linear fits with lmfit creating a residual function for a potential mathematical function to fit, just as follows def pow\_res(pars, E, data, sig): values = p…

---

## [Not sure how to get this LsqFit working](https://discourse.julialang.org/t/not-sure-how-to-get-this-lsqfit-working/88769)

<div class="topic-metadata">

**Author:** [@Mervyn\_Larrier](https://discourse.julialang.org/u/Mervyn_Larrier)\
**Replies:** 10\
**Last updated:** [October 16, 2022, 12:57am UTC](https://discourse.julialang.org/t/not-sure-how-to-get-this-lsqfit-working/88769 "2022-10-16T00:57:36Z")

</div>

I have some data that I need to fit. All the other functions work, I’m just trying to minimize the cost function model in my code. Assuming you have all the same packages as me (the only errant one may be Underscores.jl)…

---

## [How do I use LsqFit to fit points with an associated error?](https://discourse.julialang.org/t/how-do-i-use-lsqfit-to-fit-points-with-an-associated-error/88291)

<div class="topic-metadata">

**Author:** [@ultrapoci](https://discourse.julialang.org/u/ultrapoci)\
**Replies:** 2\
**Last updated:** [October 5, 2022, 8:32pm UTC](https://discourse.julialang.org/t/how-do-i-use-lsqfit-to-fit-points-with-an-associated-error/88291 "2022-10-05T20:32:07Z")

</div>

I have these points I want to fit: x y err 24.0 0.0386341 4.29118e-5 24.33 0.03952 2.10541e-5 24.66 0.0398329 1.76137e-5 25.0 0.0399503 1.75643e-5 25.33 0.0399654 1.63191e-5 25.66 0.0398724 …

---

## [Nonlinear curve fitting with weights with LsqFit](https://discourse.julialang.org/t/nonlinear-curve-fitting-with-weights-with-lsqfit/78478)

<div class="topic-metadata">

**Author:** [@achjaj](https://discourse.julialang.org/u/achjaj)\
**Replies:** 10\
**Last updated:** [March 26, 2022, 12:22pm UTC](https://discourse.julialang.org/t/nonlinear-curve-fitting-with-weights-with-lsqfit/78478 "2022-03-26T12:22:52Z")

</div>

Hello, I need to fit the exponential decay law to some data with weights. I tried to use LsqFit.jl, however the standard\_errors function returns too low values. I discovered it by comparing my results with my friend and…
