[R] mlogit.data

From: Gregory Macfarlane <gregmacfarlane_at_gmail.com>
Date: Mon, 28 Feb 2011 15:33:52 -0500


I am trying to estimate multinomial logit models off of a .csv table in IDCASE IDALT format where I have

ROWS HHID PERID CASE ALTNUM NUMALTS CHOSEN IVTT OVTT TVTT COST DIST WKZONE HMZONE RSPOPDEN RSEMPDEN WKPOPDEN....

1     1    2     1    1      1       5      1 13.38  2.00 15.38  70.63  7.69
   664    726    15.52     9.96    37.26
2     2    2     1    1      2       5      0 18.38  2.00 20.38  35.32  7.69
   664    726    15.52     9.96    37.26
3     3    2     1    1      3       5      0 20.38  2.00 22.38  20.18  7.69
   664    726    15.52     9.96    37.26
4     4    2     1    1      4       5      0 25.90 15.20 41.10 115.64  7.69
   664    726    15.52     9.96    37.26
5     5    2     1    1      5       5      0 40.50  2.00 42.50   0.00  7.69
   664    726    15.52     9.96    37.26
6     6    3     1    2      1       5      0 29.92 10.00 39.92 390.81 11.62
   738      9    35.81    53.33    32.91
7     7    3     1    2      2       5      0 34.92 10.00 44.92 195.40 11.62
   738      9    35.81    53.33    32.91
8     8    3     1    2      3       5      0 21.92 10.00 31.92  97.97 11.62
   738      9    35.81    53.33    32.91
9     9    3     1    2      4       5      1 22.96 14.20 37.16 185.00 11.62
   738      9    35.81    53.33    32.91

to bring the data.frame into R, I use

> hbwtrips<-read.csv("workdata.csv",header=TRUE, sep=",",
dec=".",row.names=NULL)

everything is fine at this point. I can generate descriptive statistics, estimate regression models, and then do everything as a good data.frame should.

But when I try to put the data into mlogit.data with

> hbwmode<-mlogit.data(hbwtrips,varying=c(8:11),shape="long",
choice="CHOSEN", alt.var="ALTNUM")

I get

Error in `row.names<-.data.frame`(`*tmp*`, value = c("1.1", "1.2", "1.3",  :
  duplicate 'row.names' are not allowed
In addition: Warning message:

non-unique values when setting 'row.names': 1.1, 10.1, 10.4, 100.4,
1000.2, 1001.1, 1001.3, 1002.2, 1002.3, 1003.4, 1004.1,
1004.2, 1005.1, 1005.3, 1007.2, 1008.3, 1008.4, 1009.1,
1009.2, 1009.3, 101.1, 1010.4, 1011.1, 1012.2, 1013.3, 1013.4, [..., truncated]

It seems as though the mlogit.data command tries to reassign my row.names, and doesn't do it right. Is this accurate? How do I move forward?

-- 
Gregory Macfarlane, EIT

Graduate Research Assistant
School of Civil and Environmental Engineering
Georgia Institute of Technology

gregmacfarlane_at_gmail.com
801.616.9822

	[[alternative HTML version deleted]]


______________________________________________ R-help_at_r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

Received on Mon 28 Feb 2011 - 21:09:49 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 01 Mar 2011 - 13:50:18 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive