Re: [R] Running a Logit Model in R

2010-01-30 Thread David Winsemius


On Jan 30, 2010, at 8:24 PM, Mathew, Abraham T wrote:



I'm an R newbie and had the following question. I'm trying to run a  
logit model because I have a dependant variable that is a factor  
with three levels. Each of my independent variables are factor  
variables and have two or more levels, which is why I'm unsure about  
the error.


How are you expecting glm to construct a _binomial_ model with a  
dependent variable that has 3 levels?




regone <- glm(data96$RV961327 ~ data96$RV960605 + data96$RV960610 +  
data96$RV960337 + data96$RV960385 + data96$RV960417 +  
data96$RV960615 + data96$RV960698 + data96   $RV960714 +  
data96$RV961145 + data96$RV960067 + data96$RV960702,  
family=binomial(logit))


Perhaps:

library(MASS)
?polr

(Or)

library(nnet)
?multinom

(Or)

library(rms)
?lrm



This produces the following error.

Error in `contrasts<-`(`*tmp*`, value = "contr.treatment") :
 contrasts can be applied only to factors with 2 or more levels


--

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Running a Logit Model in R

2010-01-30 Thread Mathew, Abraham T
 
I'm an R newbie and had the following question. I'm trying to run a logit model 
because I have a dependant variable that is a factor with three levels. Each of 
my independent variables are factor variables and have two or more levels, 
which is why I'm unsure about the error.
 
regone <- glm(data96$RV961327 ~ data96$RV960605 + data96$RV960610 + 
data96$RV960337 + data96$RV960385 + data96$RV960417 + data96$RV960615 + 
data96$RV960698 + data96   $RV960714 + data96$RV961145 + data96$RV960067 + 
data96$RV960702, family=binomial(logit))
 
This produces the following error. 
 
Error in `contrasts<-`(`*tmp*`, value = "contr.treatment") : 
  contrasts can be applied only to factors with 2 or more levels
 
 
Help,
Abraham M.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.