Home>

### parameter estimation using python's weighted least squares method (wls)

I want to make a parameter estimate using python's weighted least squares method (WLS).
● Observation data

``````x = np.array ([6, 8, 8.6, 8.7, 11.6, 12.3, 14, 15, 21, 23, 26, 26.4, 26.3, 23.1, 19, 17, 14.5, 13.5, 10, 9, 9.7])
y = np.array ([3.7, 3.3, 3.2, 2.8, 2.2, 2.24, 1.8, 1.83, 1.5, 1.36, 1.21, 1.52, 1.3, 1.34, 1.61, 1.41, 1.8, 1.88, 2.11, 2.36, 2.4])``````

● The formula I want to fit

``y = ((-(a + (0.07 * x))) + ((a + ((0.07 * x) ** 2))-(4 * 0.07 * math.log (0.1))) ** 0.5)/(2 * 0.07)``

Parameter I want to estimate → "a"

● Problem
・ I'm too new to use python
→ Looking at some sites, most of them generate observation data with random numbers, and none of them handle the observation data itself. Therefore, I don't know how to handle the data at hand.
・ Most of the explanation of WLS is linear regression
→ I found a site that uses WLS for linear approximation, but I had no idea how to apply it non-linearly.

● Sites that I mainly refer to
・ Https://scipython.com/book/chapter-8-scipy/examples/weighted-and-non-weighted-least-squares-fitting/
・ Https://medium.com/micin-developers/decipher-github-lr-sw-40e519a13c0a

The samples on the site are somehow understood so far, so I'd be happy if you could transform them into tears.
We would appreciate your help from the teachers.