Re: [R] logistic regression: categorical value, and multinomial

From: ronggui <0034058_at_fudan.edu.cn>
Date: Thu 28 Jul 2005 - 02:42:22 EST


> 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 


>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@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



R-help@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 Received on Thu Jul 28 02:59:03 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:34:05 EST