[R] length of variable in mlogit

Lee van Cleef l.van.cleef at gmx.net
Tue Aug 14 10:56:42 CEST 2012


Hi Michael,

many thanks for your time and the hint. This is much appreciated. 

Indeed, I managed it to get part of the dataset from which I want to develop
my final logit model in the correct long format with true/false standing in
the column for the choice  variable,.

But the problem with the variable I want to define with an alternative
specific coefficient (=P_id) still persists.

If doing the mlogit procedure and defining the table for this variable as 

1) a data frame I get the comment 

[Start of R quote]
Error in model.frame.default(terms(formula, lhs = lhs, rhs = rhs, data =
data),  : 
  invalid type (list) for variable 'P_id'
[End of R quote]

Btw, length of the variable/data frame P_id is 6, the length of the choice
variable is 1,406 and the length of a variable with a generic coefficient
(and which is working fine) is 8,436.

2) as a matrix, I get the comment 

[Start of R quote]
Error in model.frame.default(terms(formula, lhs = lhs, rhs = rhs, data =
data),  : 
  variable lengths differ (found for 'P_id')
[End of R quote]

Btw, length of the variable/matrix P_id is 8,436, the length of the choice
variable is 1,406 and the length of a variable with a generic coefficient
(and which is working fine) is 8,436.

Any comment or hint (also on literature, in case my mistakes are too simple
and obvious) would be helpful.

Best regards,

Lee



--
View this message in context: http://r.789695.n4.nabble.com/length-of-variable-in-mlogit-tp4638323p4640250.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list