5
$\begingroup$

A. Suppose I want to fit the regression

$Y = f(\lambda X_1 + (1-\lambda) X_2)$

where $f(x) = ax^2 + bx + c$, and $\lambda$, a, b, c are to be estimated using the data.

This is nonlinear, but it's straightforward to least-squares fit using the Levenberg–Marquardt algorithm.

B. Now, suppose I instead want to handle nonlinear binary regression, so I want to find the MLE for

$\mathrm{logit}(\mathbb{P}(Y=1)) = f(\lambda X_1 + (1-\lambda) X_2)$

Is there an efficient algorithm analogous to Levenberg–Marquardt that handles this case, or do I just need to use general numerical methods?


FWIW, the motivation behind B is as follows. The $X_i$ collectively determine an environment, with their relative contributions unknown. The environment in turn affects the probability that $Y = 1$. However there is no domain-based reason to believe that a given environment has a fixed effect on the odds ratio. That's a mathematically convenient assumption, but it may not hold in reality...

That said, this seems to be a very nonstandard thing to try, which leaves me nervous...

$\endgroup$
11
  • $\begingroup$ If you expand $f(x)$ then you can rewrite it as a linear-in-parameters function and solve it using any binary regression model. $\endgroup$
    – Sycorax
    Commented Dec 2, 2023 at 19:13
  • $\begingroup$ @Sycorax I'm afraid I don't follow. If you expand you get coefficients like $a \lambda^2$, $a \lambda$, $b\lambda$ ... what do you do with those? AFAICS you can't estimate them as you would betas in a normal regression, because they are related to each other. $\endgroup$
    – Mohan
    Commented Dec 2, 2023 at 22:53
  • $\begingroup$ You have $\beta_1=a\lambda^2$ and $\beta_2=2a\lambda(1-\lambda)$ etc. This solution set completely describes all possible solutions to the non-identifiable model you’ve described. Naive optimization will, at best, recover one solution among many. $\endgroup$
    – Sycorax
    Commented Dec 3, 2023 at 0:22
  • $\begingroup$ @Sycorax But the mapping from $(a, b, c, \lambda)$ to the ($\beta_i$) is not invertible, is it? [Because it's not surjective.] There will be some values of the $(\beta_i)$ tuple that don't correspond to any $(a, b, c, \lambda)$... what do you propose to do with those? $\endgroup$
    – Mohan
    Commented Dec 3, 2023 at 0:42
  • 1
    $\begingroup$ Insufficiency of the data is inherent to your proposed model. Choose a solution to recover the original parameters by minimizing error — eg using OLS. Another solution would fix lambda ahead of time, make a new design matrix, and then use off the shelf logistic regression. Tune $\lambda$ to find the best fit, such as with a one-dimensional optimizer. Recover the coefficients by finding the a, b with least error to the estimated coefficients. $\endgroup$
    – Sycorax
    Commented Dec 3, 2023 at 14:33

1 Answer 1

10
$\begingroup$

Using a local optimizer is not sufficient for global optimization.

Naïvely using a local optimizer (such as Levenberg–Marquardt) to find the parameters of a non-identified model is not a good idea because you have no assurance that the solution achieves a global minimum. Some models (like neural networks) simply ignore this fact, but they do so at the cost of never being able to interpret the coefficients. It's clear from the question and comment thread that you really care about this specific parameterization of the model, so you want to estimate $a,b,c,\lambda$ and not some alternative parameterization. So we should use a method that will do a good job of estimating them.


The ordinary logistic regression model is not sufficient because the model is not identified.

Let's define $X$ as the polynomial design matrix: $$ X = \begin{bmatrix} 1 & x_1^2 & x_1 x_2 & x_2^2 & x_1 & x_2 \end{bmatrix} $$ where $x_i$ is a column of the original data.

The standard logistic regression estimates $\hat y = \mathbb{P}(y=1)$ as a linear function on the logit scale, and estimates a single, distinct scalar coefficient $\beta_i$ to each column of $X$. $$ \text{logit}(\mathbb{P}(y=1)) = X\beta $$

Maximizing the likelihood (equiv. minimizing the cross entropy) has a unique optimal solution as long as $X$ is full rank and the data do not exhibit perfect . Moreover, the minimization of the loss is convex (equiv. maximization of the likelihood is concave).

So the relationship between the linear-in-parameters model and the nonlinear model is

$$ \begin{bmatrix} \beta_0 \\ \beta_1 \\ \beta_2 \\ \beta_3 \\ \beta_4 \\ \beta_5 \end{bmatrix} = \begin{bmatrix} c \\ a \lambda^2 \\ 2 a \lambda (1 - \lambda) \\ a (1 - \lambda)^2 \\ b \lambda \\ b (1 - \lambda) \end{bmatrix}. $$ If we stop here, and just estimate the linear-in-parameters model, we may not recover $a,b$, which are the desired quantities.

Enforcing some constraints such as $a > 0$ and $b > 0$ and $ 0 < \lambda < 1$ will guarantee that we can write down a system of equations that is linear in $\log \beta_i$:

$$ \begin{bmatrix} \log \beta_1 \\ \log \beta_2 \\ \log \beta_3 \\ \log \beta_4 \\ \log \beta_5 \\ \end{bmatrix} = \begin{bmatrix} 0 & 1 & 2 & 0 & 0 \\ 1 & 1 & 1 & 1 & 0 \\ 0 & 1 & 0 & 2 & 0 \\ 0 & 0 & 1 & 0 & 1 \\ 0 & 0 & 0 & 1 & 1 \\ \end{bmatrix} \begin{bmatrix} \log 2 \\ \log a \\ \log \lambda \\ \log 1 - \lambda \\ \log b \end{bmatrix} $$

However, this has its own problems:

  • (i) we would need specialized software to enforce the constraints and
  • (ii) there is no guarantee that the system is consistent.

We could fix (ii) by finding a least-error estimate of $a,b$, but would still require the constrained optimization in (i). In any event, the constraints do not appear in OP's question, so the the constrained model may not even correspond to a valid solution to OP's problem.


For fixed $\lambda$, the model is identified.

Instead, we can rewrite the proposed model to avoid these complications, at the cost of a slightly more involved estimation procedure: $$ X \begin{bmatrix} c \\ a \lambda^2 \\ 2 a \lambda (1 - \lambda) \\ a (1 - \lambda)^2 \\ b \lambda \\ b (1 - \lambda) \end{bmatrix} = X \Lambda \begin{bmatrix}c \\ a \\ a \\ a \\ b \\ b \end{bmatrix} $$ where $\Lambda$ is a diagonal matrix $$\Lambda = \begin{bmatrix} 1 & & & & & \\ & \lambda^2 & & & & \\ & &2 \lambda (1 - \lambda) & & & \\ & & &(1 - \lambda)^2 & & \\ & & & &\lambda & \\ & & & & &(1 - \lambda) \end{bmatrix}.$$

The proposed model is not linear in its parameters, so it cannot be solved using standard logistic regression software. (The parameters are not affine.)

However, this factorization gives us a significant hint: conditional on fixing $\Lambda$, the model is linear in its parameters. So we can take $X\Lambda$ as the design matrix, and then either

  • use specialized optimization software that enforces $a=\beta_1 = \beta_2 = \beta_3$ and $b=\beta_4 = \beta_5$; or
  • use a standard logistic regression software to estimate $\beta$ and then work backward to the estimates of $a,b$ by minimizing error in the linear system.

It's up to you to choose the approach that you prefer.

All of this rests on choosing $\Lambda$. The matrix $\Lambda$ has only 1 parameter. A straightforward approach is to wrap your chosen logistic regression procedure inside of a one-dimensional optimizer (e.g. bisection search), and choosing the result that achieves the best fit according to whatever criterion you desire. So you'll be testing a sequence of $\Lambda^{(k)}$ matrices, and estimating coefficients $\beta^{(k)}$ (or $a^{(k)}, b^{(k)}$) for each one. The final model is the $\Lambda^{(k)}$ and $\beta^{(k)}$ (or $a^{(k)}, b^{(k)}$) that has the best fit.

This approach is broadly similar to Do statisticians assume one can't over-water a plant, or am I just using the wrong search terms for curvilinear 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.