1
$\begingroup$

I am trying to fit a curve to a set of measured data. Similar studies have been done, and the resulting curve fit is usually of the following form.

$$\frac{1}{\sqrt{Y}}=a \log{\left(X \sqrt{Y}\right)}-b$$

I need to find the $a$ and $b$ that will result in the least error; I think maximizing $R^2$ would suffice.

The method to do this is not clear to me, as $Y$ is found on both sides of the equation with no obvious way to simplify. Is iteratively solving a system of equations (left and right sides) my best option?

I currently have the data in excel, which provided me a power fit that is not sufficiently accurate. Equations of the form above have a more accurate trend. I plan to do this new curve fitting in python, as it would probably be a pain in excel.

Ideally I would simplify this equation to be of the form $Y=f(X)$, as it is the $Y$ that I need to calculate from the $X$ when using my model. I just don't know a good way to do that.

$\endgroup$
8
  • 1
    $\begingroup$ Can you supply a reference where this has been used? There is a way to isolate y one just one side of the equation so I’m a bit suspicious as to the claim that someone started with the equation in this form. $\endgroup$
    – JimB
    Commented Aug 28, 2022 at 18:25
  • 1
    $\begingroup$ A good method will pay close attention to the nature and magnitudes of the measurement errors. What can you tell us about them? There are subtleties with such fits, even when the implicit equation defines a line or circle. One of them is that even with nice data and compact curves the confidence regions for the fits can be unbounded. Another is that the best maximum likelihood fit might deviate much further from the data than an obvious visual fit. For an extended account of those issues, see Chernov, Circular and Linear Regression. $\endgroup$
    – whuber
    Commented Aug 28, 2022 at 18:30
  • 1
    $\begingroup$ Solving for $y$ results in $y= \frac{1}{a^2 W\left(\frac{x e^{-\frac{b}{a}}}{a}\right)^2}$ where $W$ represents the Lambert $W$ function (en.wikipedia.org/wiki/Lambert_W_function). If you don't know what error structure is appropriate a priori, then looking at the residuals after trying an additive error is then especially necessary. $\endgroup$
    – JimB
    Commented Aug 28, 2022 at 20:00
  • $\begingroup$ @JimB equations of this form are used for the Darcy friction factor. $\endgroup$ Commented Aug 28, 2022 at 20:46
  • 3
    $\begingroup$ Thanks. That helps because it's not just about the numbers and equations but very much so about the subject matter. $\endgroup$
    – JimB
    Commented Aug 28, 2022 at 20:53

1 Answer 1

0
$\begingroup$

For each couple $(X,Y)$ compute $x=\log( X \times \sqrt{Y} )$ and $y=1/\sqrt Y.$

Then the data is the couple $(x,y)$ related as $y=a \cdot x - b. $

$a$ and $b$ are obtained thanks to linear regression.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.