## Working with arbitrary units:¶

But, suppose that instead of having $y_i$ in units of concentration, we measure $y_i$ using a fluorescence assay and our units are arbitrary. In practice, actin polymerization is almost always measured using pyrene actin, a specially labeled form of actin that becomes fluorescent when it polymerizes.

Now, we can no longer directly minimize the difference between our simulation and the experimental data, since our simulation is in units of concentration, and our measurents are in arbitrary units. One option is to explicitly add a parameter to our model. We can simply define a new function, $G(x)$:

$G(x) = x[0] * f(x[1:])$

which takes an extra parameter, and scales the simulation. This however adds a parameter to the model, and, in my experience, makes parameter much slower.

## Implicit Scale Factors:¶

An alternative way is to write out the minimization like so (we are assuming homoscedasticity to simplify the expression and ignore the variance of each individual point):

$\underset{x}{\arg\min} \sum_i (\beta F(x)_i - y_i)^2$

At this point - we notice that, for a given set of parameters $x$, our loss function implicitly defines an optimal scaling factor $\beta$ - it's the scaling factor that minimizes the residuals, given a simulation $F(x)$ and data $y$.

To find the optimal scale factor, we derive our loss function with respect to $\beta$

$$
\frac{d} {d \beta} \sum_i (\beta F(x)_i - y_i)^2 = 0 \\
$$

and solve (the best reference I've found for this is Ryan Gutenkust's PhD thesis and the corresponding implementation in SloppyCell:

$$
\beta = \frac{\sum_i F(x)_i y_i }{\sum_i F(x)_i^2 } \\
$$

## Updating the Jacobian:¶

However, now when we calculate the Jacobian, we also have to consider the effect that varying the parameter will have on the scaling factor:

$$
\frac{d}{dx} (\beta(x) F(x)) = \frac{d\beta(x)}{dx}F(x) + \frac{dF(x)}{dx}\beta(x)
$$

$ \frac{dF(x)}{dx}$ is the old Jacobian. Now we need to calculate $\frac{d\beta(x)}{dx}$. To obtain that, we derive the equation for $\beta$ with respect to $x$.

$$
\frac{d\beta}{dx} = \frac{d}{dx} \frac{ \sum_i \frac{dF(x)_i}{dx} y_i}{ \sum_i F(x)_i^2}
$$