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)