this is equation of functional response following polynomial logistic regression with binomial distribution Na=N (exp p0 + p1 N + p2 N^2 + p3 N^3 ) /(1 + exp (p0 + p1 N + p2 N^2 + p3 N^3)). I would like to know how to estimate Maximum likelihood of this equation with parameters p0, p1, p2 and p3 being constant, linear, quadratic and cubic coefficients,


1 Answer 1


It’s the usual logistic regression maximum likelihood estimation. Your model matrix has a column of all $1$s (for the intercept), a column of your variable, a column of your variable squared, and a column of your variable cubed. Once you have that, you get let the maximum likelihood numerical optimization go. That you created the model matrix by calculating exponents of your variable does not matter to the optimization. This is a key point in generalized linear models: the interpretation of models and their coefficients may depend on how you designed the features, but the math of estimating those parameters does not know, let alone care, how you got to those numbers.

As far as how the calculation goes, there is no closed-form solution like there is in an OLS linear model that has $\hat\beta_{ols}=(X^TX)^{-1}X^Ty$. The typical way to approximate the maximum likelihood estimate is to have a computer numerically optimize a multivariable function.

$$ \underset{\hat\beta_0,\hat\beta_1,\hat\beta_2,\hat\beta_3}{\arg\max}\left\{ \sum_{i=1}^n\left[ y_i\log(\hat y_i)+(1-y_i)\log(1-\hat y_i) \right] \right\}\\ \hat y_i =\dfrac{1}{ 1+\exp\left(-\left( \hat\beta_0+\hat\beta_1x_i+ \hat\beta_2x_i^2+ \hat\beta_3x_i^3 \right) \right) }\\ y_i\in\left\{0,1\right\} $$

This equation comes from the binomial log likelihood, since the conditional distribution in a logistic regression is binomial.

The typical syntax in R would be to use the glm function with family = binomial, which defaults to the logistic regression link function. Parameter estimation with this implementation will be via maximum likelihood estimation, as is desired in the OP.

  • $\begingroup$ can you give me an example so thai i can understand better $\endgroup$ Commented Feb 17, 2023 at 4:52
  • $\begingroup$ there is an dataset named Gammarus in package frair $\endgroup$ Commented Feb 17, 2023 at 4:53
  • $\begingroup$ @mayurwabhitkar Example of what? $\endgroup$
    – Dave
    Commented Feb 17, 2023 at 4:57
  • $\begingroup$ example of this code $\endgroup$ Commented Feb 17, 2023 at 5:07
  • 1
    $\begingroup$ stackoverflow.com/a/29522905 @mayurwabhitkar $\endgroup$
    – Dave
    Commented Feb 17, 2023 at 5:10

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.