Skip to content

How to create design matrix for LLMNL?

2 messages · Tetyana Stepanchuk, Spencer Graves

#
Hello, 

 

I have a small problem with developing design matrix X, which I use in
estimation the log-likelihood of a multinomial logit model.

 

I have the data: 

 number of observation - 289

number of choice alternative- 3

number of choice specific variables in matrix X -4

matrix X =289x4

I tried to use the function createX, I know that I have to get design matrix
289x12 (am I right?) but it always says "bad dim" (my code and data in
attachment)

 

Where is my fault? Can I use another method in order to create design
matrix? 

Or need it at all here in logmnl (see code in attachment)?

 

Can anyone help me with this issue?

 

Thanks in advance,

Tatyana

 

 

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: createX.txt
Url: https://stat.ethz.ch/pipermail/r-help/attachments/20050819/0f1fb3ae/createX.txt
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: logmnl.txt
Url: https://stat.ethz.ch/pipermail/r-help/attachments/20050819/0f1fb3ae/logmnl.txt
6 days later
#
I haven't seen a reply to this, so I will attempt a few comments.  If 
you've already received an adequate reply, please excuse my tardy 
comments.

	  1.  It is generally not wise to use the name of a standard S / R 
function for a data.frame.  Please type "df" at a command prompt to see 
what you get.  In this case, this is probably not creating problems for 
you, but it might in other contexts.

	  2.  Did you try the examples in the help file for "createX" in 
library(bayesm)?  If no, I suggest you do so.  If yes, I suggest you 
examine carefully your call to "createX" in comparison with the examples 
and the rest of the documentation.

	  3.  If you still have a question, please submit another post after 
(re)reading posting guide! 
"http://www.R-project.org/posting-guide.html".  You may think you 
already did this.  However, 289 observations in an attached file is not, 
for me at least, a toy example within the spirit of the posting guide. 
That posting guide is not intended to be a burocratic obstacle.  It was 
written to help people get quicker answers to their questions.  When 
followed, I believe it succeeds fairly well.  To me it is roughly like 
the famous book by George P??lya on "How to Solve It", which I also 
highly recommend.

	  Viel Glueck!
	  spencer graves
Tetyana Stepanchuk wrote: