[R] Categorical Response Query
andyer weng
nzandyer at gmail.com
Tue Oct 21 00:39:03 CEST 2008
Hi all,
I have a queston about Categorical response.
i have a data frame containing age, sex, class, success(1=success,
0=non sucess).
age, sex,class are the explantory variables, and sucess is the
response variable. and i can get n (the nunber of times each age
occurs) and r (the number of sucess of that age).
when I try to creat the regression relationship for these variables, I
have seen many different cases, i just wonder which one fits me the
best for this situation.
1st case,
xxx.glm<-glm(success~age*sex*class,family=binomial, data=xxx.data)
2nd case
xxx.glm<-glm(r/n~age*sex*class,family=binomial, data=xxx.data)
3rd case
xxx.glm<-glm(cbind(r,n-r)~age*sex*class,family=binomial, data=xxx.data)
what is difference between the above 3 cases? which one is the best to use?
if Ii don't group the data, can I use the 1st case. if i group the
data, can i use 2nd or 3rd case?
please advise.
Cheers.
Andyer
More information about the R-help
mailing list