forum.alglib.net
http://forum.alglib.net/

Proper use of Multinomial logit regression
http://forum.alglib.net/viewtopic.php?f=2&t=318
Page 1 of 1

Author:  BrotherOdin [ Fri Mar 11, 2011 2:10 pm ]
Post subject:  Proper use of Multinomial logit regression

I am looking for the proper way to generate the Multinomial logit regression.

My data set is based on a survey responses which vary from 1 to 7 from Most Disatisfied to Most Satisfied. I was given SPSS syntax to validate the output that we need to calculate using an external library. In this case, I am hoping to make use of this library for it.

The SPSS syntax is:
plum satscore with score1 score2 score3
/link = logit
/print = parameter summary tparallel.

Data:
{6.0, 6.0, 7.0, 6.0} ,{5.0, 6.0, 7.0, 5.0} ,{4.0, 6.0, 7.0, 4.0} ,{7.0, 6.0, 7.0, 5.0} ,{6.0, 6.0, 7.0, 6.0} ,{7.0, 6.0, 7.0, 6.0} ,{5.0, 5.0, 7.0, 6.0} ,{7.0, 5.0, 7.0, 5.0} ,{4.0, 6.0, 6.0, 5.0} ,{5.0, 6.0, 7.0, 5.0} ,{5.0, 6.0, 7.0, 3.0} ,{5.0, 6.0, 7.0, 3.0} ,{6.0, 7.0, 6.0, 4.0} ,{6.0, 6.0, 6.0, 4.0} ,{5.0, 6.0, 6.0, 5.0} ,{7.0, 6.0, 6.0, 6.0} ,{4.0, 6.0, 7.0, 1.0} ,{6.0, 6.0, 7.0, 6.0} ,{5.0, 6.0, 6.0, 4.0} ,{4.0, 5.0, 5.0, 2.0} ,{7.0, 7.0, 7.0, 5.0} ,{5.0, 7.0, 7.0, 5.0} ,{7.0, 7.0, 7.0, 6.0} ,{6.0, 6.0, 6.0, 5.0} ,{3.0, 6.0, 6.0, 0.0}

{score1, score2, score3, satscore}

Score 1 to 3 have been left unmodified in their respective ranges from 1 to 7, but following the instructions I have adjusted satscore to a range from 0 to 6 (rather than 1 to 7).

Code:
            int nAttributes = 3;
            int nSamples = 25;
            int nClasses = 7;

            double[,] tsData = new double[25, 4] {
                {6.0, 6.0, 7.0, 6.0}   ,{5.0, 6.0, 7.0, 5.0}   ,{4.0, 6.0, 7.0, 4.0}   ,{7.0, 6.0, 7.0, 5.0}   ,{6.0, 6.0, 7.0, 6.0}   ,{7.0, 6.0, 7.0, 6.0}   ,{5.0, 5.0, 7.0, 6.0}   ,{7.0, 5.0, 7.0, 5.0}   ,{4.0, 6.0, 6.0, 5.0}   ,{5.0, 6.0, 7.0, 5.0}   ,{5.0, 6.0, 7.0, 3.0}   ,{5.0, 6.0, 7.0, 3.0}   ,{6.0, 7.0, 6.0, 4.0}   ,{6.0, 6.0, 6.0, 4.0}   ,{5.0, 6.0, 6.0, 5.0}   ,{7.0, 6.0, 6.0, 6.0}   ,{4.0, 6.0, 7.0, 1.0}   ,{6.0, 6.0, 7.0, 6.0}   ,{5.0, 6.0, 6.0, 4.0}   ,{4.0, 5.0, 5.0, 2.0}   ,{7.0, 7.0, 7.0, 5.0}   ,{5.0, 7.0, 7.0, 5.0}   ,{7.0, 7.0, 7.0, 6.0}   ,{6.0, 6.0, 6.0, 5.0}   ,{3.0, 6.0, 6.0, 0.0}
            };

            alglib.logitmodel lm = new alglib.logitmodel();
            alglib.mnlreport rep = new alglib.mnlreport();
            int info = -1;

            alglib.mnltrainh(tsData, nSamples, nAttributes, nClasses, out info, out lm, out rep);


The output I am looking for are the estimates for each score and thresholds for further analysis. The attached image has what I am looking for based on the SPSS output.

At this point I am unclear what I can do to this model to obtain what I need. Any suggestions?

Attachments:
File comment: SPSS Output
Logit.png
Logit.png [ 8.26 KiB | Viewed 3859 times ]

Author:  Sergey.Bochkanov [ Mon Mar 14, 2011 2:31 pm ]
Post subject:  Re: Proper use of Multinomial logit regression

Hmm... As for now, ALGLIB doesn't calculate these coefficients. The only thing you can do is to calculate them using definition.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/