melff / mclogit

mclogit: Multinomial Logit Models, with or without Random Effects or Overdispersion
http://melff.github.io/mclogit/
22 stars 4 forks source link

Working covariance matrix #12

Closed Zhiwen-Owen-Jiang closed 3 years ago

Zhiwen-Owen-Jiang commented 3 years ago

Hi Prof. Martin Elff, I looked into your code of function mmclogit.fitPQLMQL, and found that you define the working covariance matrix W the same as the variance and covariance of multinomial distribution. W <- Diagonal(x=w*pi)-tcrossprod(W). I am curious about the reason why. Because according to the paper of Breslow and Clayton in 1993, W is defined as $(\phia_iv(\mu_i)*g'(\mu_i)^2)^{-1}$, where v(\mu_i) is 'W' in your code. It appears that now, your W^{-1} is not the variance covariance matrix of the working response variable y.star.

Thanks in advance.

melff commented 3 years ago

Breslow and Clayton do not consider multinomial logit models. In "ordinary" logit models, Poisson models, etc. the weight matrix is diagonal and and an inverse of W. In the multinomial logit case, the matrix W is non-diagonal and singular. A diagonal weighting matrix nevertheless is a generalised inverse of W. As far as I can see, the justification if IWLS does not require that W is an inverse of a diagonal weighting matrix, but conversely that the diagonal weighting matrix is a generalised inverse of W. See https://www.elff.eu/software/mclogit/technical/fitting-mclogit/ and https://www.elff.eu/software/mclogit/technical/approximations/