Skip to content

Logistic regression conditional variance in R

January 22, 2013

I’ve talked about exploiting the relationship between logistic regression and the logistic distribution in R. Here I clean up this reference into a table and add the expressions for the conditional variance.

words math r
linear predictor \eta = \log(\frac{\mu}{1-\mu}) eta <- qlogis(mu)
conditional mean \mu = \frac{1}{1 + e^{-\eta}} mu <- plogis(eta)
conditional variance V = \mu (1 - \mu) = \frac{e^\eta}{(1 + e^\eta)^2} V <- dlogis(qlogis(mu)) <- dlogis(eta)
Advertisements
2 Comments leave one →
  1. February 6, 2013 1:40 pm

    This is interesting! Though arguably only tangentially related, maybe you have some input on how to pair the logistic distribution to a MLE fitting of a logistic growth curve? I have been looking into this for a while (http://stats.stackexchange.com/questions/25621/what-is-the-distribution-of-the-error-around-logistic-growth-data) and trying to implement it in R (https://github.com/low-decarie/Useful-R-functions/blob/master/Growth%20curves/logistic_growth_mle_logit.R).

    • February 6, 2013 2:24 pm

      Thanks.

      I don’t have any input on your logistic growth model problem, except that I don’t think the logistic distribution functions in R would be of much use. For instance, the logistic distribution in base R corresponds to a symmetric distribution, but the growth model would correspond to a skew distribution (I think??).

      You probably know this already, but in case you don’t, Ben Bolker and students have done quite of bit of similar work on fitting various classical ecological models by maximum likelihood. The bbmle package is very useful for this stuff:

      http://cran.r-project.org/web/packages/bbmle/index.html

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: