# Logistic regression with negative weights in Matlab

I want to apply a logistic regression to a set of data where observations have been assigned weights depending on their "distance" from {0,1}. Most of the observations have weights within [0,1] range, but some could be outside. (I know that this means that the binomial model is not really suitable, but let's say this is a restriction I am working under). If I write out a log-likelihood for an observation as

$$w_i \ln(p(X\beta)) + (1-w_i)\ln(1-p(X\beta))$$

then this seems to work as desired: observations that have weights above 1 "pull the p" higher, and those with negative weights "pull the p" lower.

However, when I try to use this weights in Matlab's glmfit, I get a warning "Weights are ill-conditioned." The documentation in Matlab on how the weights are used is "thin" (it just says "Vector of prior weights, such as the inverses of the relative variance of each observation" without any explanation on where and how they are used in the procedure), but it seems that they are used in some other way than just to multiply the log-likelihood.

How are the weights applied in glmfit and how do I achieve the above log-likelihood?

• Negative weights make little sense. Could you explain what they are intended to reflect in terms of the probability model? – whuber Nov 1 '18 at 14:14
• @whuber Thank you for your comment. As I mention in the post, the binomial is not really correct model here for the response variable (a gamma distribution would be mote appropriate), but I know that the expectation lies between some minimum and maximum bounds, so I am looking to model it as $E[Y] = E_{min}(X) + \delta(X\beta)*(E_{max}(X)-E_{min}(X))$ where delta is some function from X to {0,1} for which I am looking to use logit, hence I find myself using logistic regression. – Confounded Nov 1 '18 at 14:33
• But how does that work with negative weights? It isn't at all apparent what the weights are doing or what you are hoping they will accomplish. It's certain that Matlab is not expecting negative weights! – whuber Nov 1 '18 at 14:35
• @Let's forget about the negative weights for the moment. How are weights actually applied in glmfit? – Confounded Nov 1 '18 at 14:58
• According to radio.feld.cvut.cz/matlab/toolbox/stats/glmfit.html, the weights would multiply the contribution to the log likelihood from each observation. That's not what your formula does. – whuber Nov 1 '18 at 15:54