For binary choice, I know I can use glm
to estimate a binary Probit model. However, for teaching purpose, since I am going to move on to multinomial choice at a later stage (with more than two alternatives), I try to use mlogit
package all the way through. The odd thing is that mlogit
package seems to be unable to deal with a binary Probit problem.
Suppose the data set I imported is called "data.set". The CSV file can be downloaded from this link.
Here is my program
Given the CSV data has been imported as data.set. I run the following lines.
library(mlogit)
data.set2<-mlogit.data(data.set,choice='GRADE',shape='wide')
mlogit(GRADE~ 0 | GPA+TUCE+PSI ,data=data.set2,probit=TRUE)
Then I get the error message:
Error in M[, ((i - 1):(J - 2))] : subscript out of bounds In addition: Warning message: In rbind(0, diag(J - 2)) : number of columns of result is not a multiple of vector length (arg 1)
My "data.set2" is a mlogit
data frame, which looks like:
GPA TUCE PSI GRADE chid alt
1.0 2.66 20 0 TRUE 1 0
1.1 2.66 20 0 FALSE 1 1
2.0 2.89 22 0 TRUE 2 0
2.1 2.89 22 0 FALSE 2 1
3.0 3.28 24 0 TRUE 3 0
3.1 3.28 24 0 FALSE 3 1