[R] logistic regression: categorical value, and multinomial

ronggui 0034058 at fudan.edu.cn
Wed Jul 27 18:42:22 CEST 2005


> d<-data.frame(y=sample(letters[1:2],100,T),x=rnorm(100))
> head(d,10)
   y           x
1  b  0.55915620
2  b  0.87575380
3  b -0.13093156
4  b  0.75925729
5  b  0.40233427
6  b  1.34685918
7  a  1.10487752
8  a -2.27456596
9  a  1.65919787
10 b  0.05095611

> glm(y~x,data=d,family=binomial)

Call:  glm(formula = y ~ x, family = binomial, data = d) 

Coefficients:
(Intercept)            x  
     0.2771       0.5348  

Degrees of Freedom: 99 Total (i.e. Null);  98 Residual
Null Deviance:      136.1 
Residual Deviance: 129.5        AIC: 133.5 


======= 2005-07-28 00:22:55 ÄúÔÚÀ´ÐÅÖÐÐ´µÀ£º=======

>I have two questions:
>
>1. If I want to do a binomial logit, how to handle the
>categorical response variable? Data for the response
>variables are not numerical, but text.
>
>2. What if I want to do a multinomial logit, still
>with categorical response variable? The variable has 5
>non-numerical response levels, I have to do it with a
>multinomial logit.
>
>Any input is highly appreciated! Thanks!
>
>Ed
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

= = = = = = = = = = = = = = = = = = = =
			


 

2005-07-28

------
Deparment of Sociology
Fudan University

Blog:http://sociology.yculblog.com




More information about the R-help mailing list