[R] problems with MNP

Joan Serra jserra at uchicago.edu
Wed Jul 13 15:14:31 CEST 2005


Hi all,

Does anybody have a hint on what may be going wrong in this R code? I 
mimic the sample code from the MNP developers but I seem unable to get the 
choice specific variables right.

Thanks,
Joan Serra

> rm(list=ls())
> library(foreign)
> small<-read.spss("small.sav")
Warning message:
small.sav: Unrecognized record type 7, subtype 13 encountered in system
file.
> library(MNP)
MNP: R Package for Fitting the Multinomial Probit Models
Version: 1.3-1
URL: http://www.princeton.edu/~kimai/research/MNP.html
>
>      res1 <- mnp(PREVOTE3 ~ 1, choiceX = list(1=UCLC, 2=UDLC, 3=UPLC),
Error: syntax error
>                  cXnames = "ut", data = small, n.draws = 500, burnin =
100,
Error: syntax error
>                  verbose = TRUE)
Error: syntax error
>
> # another try giving arbitrary names to the values of the dependent
variable
>
>      res1 <- mnp(PREVOTE3 ~ 1, choiceX = list(Clinton=UCLC, Dole=UDLC,
Perot=UPLC),
+                  cXnames = "ut", data = small, n.draws = 500, burnin =
100,
+                  verbose = TRUE)

The base category is `1'.

The total number of alternatives is 3.

Error in xmatrix.mnp(formula, data = eval.parent(data), choiceX =
call$choiceX,  :
         Error: Invalid input for `choiceX.'
  Some variables do not exist.
>
> # another try using a string type dependent variable
>
>      res1 <- mnp(PRVOTE3 ~ 1, choiceX = list(Clinton=UCLC, Dole=UDLC,
Perot=UPLC),
+                  cXnames = "ut", data = small, n.draws = 500, burnin =
100,
+                  verbose = TRUE)
Error in model.frame(formula, rownames, variables, varnames, extras,
extranames,  :
         invalid variable type
>




More information about the R-help mailing list