[R] problems with MNP

From: Joan Serra <jserra_at_uchicago.edu>
Date: Wed 13 Jul 2005 - 23:14:31 EST


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
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jul 13 23:18:03 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:37 EST