forum.alglib.net

ALGLIB forum
It is currently Sun Dec 22, 2024 9:08 am

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Proper use of Multinomial logit regression
PostPosted: Fri Mar 11, 2011 2:10 pm 
Offline

Joined: Fri Mar 11, 2011 1:53 pm
Posts: 1
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 3854 times ]
Top
 Profile  
 
 Post subject: Re: Proper use of Multinomial logit regression
PostPosted: Mon Mar 14, 2011 2:31 pm 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
Hmm... As for now, ALGLIB doesn't calculate these coefficients. The only thing you can do is to calculate them using definition.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 35 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group