[R] predict() works with the design matrix but throws error with some rows of that matrix

peter dalgaard pdalgd at gmail.com
Fri Nov 20 18:23:42 CET 2015

> On 20 Nov 2015, at 17:17 , Damir Cosic <damir.cosic at gmail.com> wrote:
> To do the same with matrix multiplication, I use the expression 1/(1+exp(-xb)):
> head(1/(1+exp(-(cbind(c(1), mm) %*% coef(m)[2,]))))
> which should produce the third column above, but it doesn't:

I'm rusty on this, but I suspect that you need


with e_i = exp(x b_i)

(and b_1 == 0 by convention)


Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com

More information about the R-help mailing list