Hello! I need to classify a data set with 19 variables and 9 classes using Logistic Regression(on R). I know that when we have only 2 classes we can use glm() to estimate the coefficients of the model. But I don?t understand how can I do a classification task with Logistic Regression on a data set with 9 classes! Does anybody know how can I estimate these coefficients (of a model with 9 classes) on R? Thank you! Janete -------------------------------------------- sapo.pt/kitadsl -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
You can't do `logistic regression' as usually defined with more than two classes. You can do multinomial logistic regression, sometimes known as multiple logistic regression: use function multinom() in package nnet (part of the VR bundle), most easily. On Thu, 28 Nov 2002, someone purporting to be Luis Silva wrote:> Hello! > > I need to classify a data set with 19 variables and 9 classes > using Logistic Regression(on R). > I know that when we have only 2 classes we can use glm() to > estimate the coefficients of the model. But I donĀ“t understand > how can I do a classification task with Logistic Regression on > a data set with 9 classes! > Does anybody know how can I estimate these coefficients (of a > model with 9 classes) on R? > > Thank you! > JaneteThat doesn't seem to match the mail address.> sapo.pt/kitadslWhat does that mean? -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hope this helps: Your approach depends on your statistical theory. If the 9 categories are ordered, the ordinal logistic (or probit) model is called for. The first publication I know of that proposed it was R D McKelvey and W Zavoina. A statistical model for the analysis of ordinal level dependent variables.Journal of Mathematical Sociology, 4:103-120, 1975. The idea is that the probability of falling into one category depends on z=XB+e, where e is either logistic or Normal, depending on your taste. THe resulting estimates give you estimates of B as well as 8 "thresholds" which divide the "z scale" into sections and relate to the predicted outcome for the categories. For that, the MASS packages has polr. If the 9 categories are unordered, then some other statistical model altogether is needed. One I know of is often called a multinomial model, where you set one category as the baseline and then estimate the impact of the variables to differentiate them from the baseline. For 9 cagegories, you'd end up with 8 models, of the sort ln(Pj/P0) = Xbj, j=1,...8. In MASS, the function multinom is for that purpose, but I have not tried it. Luis Silva wrote:> Hello! > > I need to classify a data set with 19 variables and 9 classes > using Logistic Regression(on R). > I know that when we have only 2 classes we can use glm() to > estimate the coefficients of the model. But I don?t understand > how can I do a classification task with Logistic Regression on > a data set with 9 classes! > Does anybody know how can I estimate these coefficients (of a > model with 9 classes) on R? > > Thank you! > Janete >-- Paul E. Johnson email: pauljohn at ukans.edu Dept. of Political Science http://lark.cc.ku.edu/~pauljohn University of Kansas Office: (785) 864-9086 Lawrence, Kansas 66045 FAX: (785) 864-5700 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Possibly Parallel Threads
- does multinomial logistic model from multinom (nnet) has logLik?
- difference of the multinomial logistic regression results between multinom() function in R and SPSS
- Logistic regression problem: propensity score matching
- help with polytomous logistic regression
- formatting data to be analysed using multinomial logistic regression (nnet)