[R] Runtime Error with multinom

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Jul 31 15:56:09 CEST 2009


Well, I get

> multinom(formula(data),data=data[Z,])
# weights:  6 (0 variable)
initial  value 0.000000
final  value 0.000000
converged
Call:
multinom(formula = formula(data), data = data[Z, ])

Coefficients:
      (Intercept) factor2f factor2g factor2h size

Residual Deviance: 0
AIC: 0
Warning message:
In multinom(formula(data), data = data[Z, ]) : groups b c d are empty

and no error.

This is clearly a nonsensical application of my work, as

> data[Z, ]
     factor1 factor2 size
1         a       e    3
1.1       a       e    3
1.2       a       e    3

contains no discriminatory information.

By using valgrind I can see a possible crash, but really this needs a
'how dare you use my work so carelessly' message.

On Mon, 20 Jul 2009, Uwe Ligges wrote:

>
>
> Andreas Wittmann wrote:
>> Dear R-users,
>> 
>> i try to fit a multinomial model in order to get an imputation for a 
>> missing value in factor1.
>> 
>> library(nnet)
>> factor1 <- factor(c("a","b","c","d"))
>> factor2 <- factor(c("e","f","g","h"))
>> size <- c(3,8,2,1)
>> 
>> factor1[3] <- NA
>> Z<-ifelse(is.na(factor1), 0, 1)
>> 
>> assign("data", cbind.data.frame(factor1,factor2,size),pos=1)
>> multinom(formula(data),data=data[Z,])
>> 
>> when entering the last line i get a runtime error and R crashes down.
>> 
>> my system is windows xp and R 2.9.1, i tried it also with ubuntu 9.04 and 
>> R.2.8.1 but i get a quite similar error.
>> 
>> Many thanks if anyone could tell me what i do wrong and what is the problem 
>> here.
>
>
> Please report bugs in packages to the package maintainer (who in this case 
> probably has read your message already, CCing anyway).

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list